[ofa-general] Re: [PATCH] opensm/ucast_cache: loop over switches table to scan switches
Yevgeny Kliteynik
kliteyn at dev.mellanox.co.il
Thu Oct 9 18:10:11 PDT 2008
Hi Sasha,
Sasha Khapyorsky wrote:
> Cache validator scans all switches by looping over all fabric nodes
> table. This patch improves this slightly by using a fabric switches
> table instead.
Right, it does improve the loop slightly. Thanks.
Patch looks fine.
-- Yevgeny
> Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
> ---
> opensm/opensm/osm_ucast_cache.c | 16 ++++++----------
> 1 files changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/opensm/opensm/osm_ucast_cache.c b/opensm/opensm/osm_ucast_cache.c
> index e5264cd..df8b7d2 100644
> --- a/opensm/opensm/osm_ucast_cache.c
> +++ b/opensm/opensm/osm_ucast_cache.c
> @@ -525,7 +525,7 @@ static void ucast_cache_validate(osm_ucast_cache_t * p_cache)
> osm_physp_t * p_physp;
> osm_physp_t * p_remote_physp;
> osm_port_t * p_remote_port;
> - cl_qmap_t * p_node_guid_tbl;
> + cl_qmap_t * p_sw_tbl;
>
> OSM_LOG_ENTER(p_cache->p_ucast_mgr->p_log);
> if (!p_cache->valid)
> @@ -537,18 +537,14 @@ static void ucast_cache_validate(osm_ucast_cache_t * p_cache)
> * it's just some node/port reset or a cached topology
> * change. Otherwise the cache is invalid.
> */
> - p_node_guid_tbl = &p_cache->p_ucast_mgr->p_subn->node_guid_tbl;
> - for (p_node = (osm_node_t *) cl_qmap_head(p_node_guid_tbl);
> - p_node != (osm_node_t *) cl_qmap_end(p_node_guid_tbl);
> - p_node = (osm_node_t *) cl_qmap_next(&p_node->map_item)) {
> -
> - if (osm_node_get_type(p_node) != IB_NODE_TYPE_SWITCH)
> - continue;
> + p_sw_tbl = &p_cache->p_ucast_mgr->p_subn->sw_guid_tbl;
> + for (p_sw = (osm_switch_t *) cl_qmap_head(p_sw_tbl);
> + p_sw != (osm_switch_t *) cl_qmap_end(p_sw_tbl);
> + p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item)) {
>
> + p_node = p_sw->p_node;
> lid_ho = cl_ntoh16(osm_node_get_base_lid(p_node,0));
> p_cache_sw = __cache_get_sw(p_cache, lid_ho);
> -
> - p_sw = p_node->sw;
> max_ports = osm_node_get_num_physp(p_node);
>
> /* skip port 0 */
More information about the general
mailing list