[ofa-general] [PATCH] opensm/osm_ucast_mgr: code consolidation and cleanup

Yevgeny Kliteynik kliteyn at mellanox.co.il
Wed Jun 25 00:53:51 PDT 2008


Hi Sasha,

Sasha Khapyorsky wrote:
> There are some code consolidation, functionality merging and removing
> intermediate lists. Also osm_port_t structure has list_item field now
> which is used to maintain port order list for routing.
>
> This is a preparation for routing port ordering based on leaf switches
> reverse sorted by number of active links.
>
> Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
> ---
>  opensm/include/opensm/osm_port.h      |    4 +
>  opensm/include/opensm/osm_ucast_mgr.h |    5 +
>  opensm/opensm/osm_ucast_mgr.c         |  254 ++++++---------------------------
>  3 files changed, 55 insertions(+), 208 deletions(-)
OpenSM crashed in cl_qlist_insert_tail() on the following assert:

    CL_ASSERT(p_list_item->p_list != p_list);

See below:

> -static void
> -__osm_ucast_mgr_build_fwd_tables(IN osm_ucast_mgr_t * const p_mgr)
> +static void add_port_to_order_list(cl_map_item_t * const p_map_item, void *ctx)
>  {
> -	struct osm_ucast_port_context ctx;
> -	osm_opensm_t *p_osm;
> -	cl_qmap_t *p_sw_guid_tbl;
> -	cl_qlist_t guid_routing_order_list;
> -	cl_qlist_t port_routing_order_list;
> -	unsigned int lists_created = 0;
> -	unsigned int use_routing_order = 0;
> -	int ret = 0;
> +	osm_port_t *port = (osm_port_t *)p_map_item;
> +	osm_ucast_mgr_t *m = ctx;
>  
> -	p_osm = p_mgr->p_subn->p_osm;
> -	p_sw_guid_tbl = &p_mgr->p_subn->sw_guid_tbl;

Crashed during cl_qlist_insert_tail(...) here:

> +	if (!port->flag)
> +		cl_qlist_insert_tail(&m->port_order_list, &port->list_item);
> +	else
> +		port->flag = 0;
> +}
...
> +static void ucast_mgr_build_lfts(osm_ucast_mgr_t *p_mgr)
> +{
> +	cl_qlist_init(&p_mgr->port_order_list);
>  
> -		OSM_LOG(&p_osm->log, OSM_LOG_DEBUG,
> +	if (p_mgr->p_subn->opt.guid_routing_order_file) {
> +		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
>  			"Fetching guid routing order file %s\n",
> -			p_osm->subn.opt.guid_routing_order_file);
> -
> -		cl_qlist_init(&guid_routing_order_list);
> -		cl_qlist_init(&port_routing_order_list);
> -
> -		lists_created++;
> +			p_mgr->p_subn->opt.guid_routing_order_file);
>  
> -		list_ctx.p_mgr = p_mgr;
> -		list_ctx.p_list = &guid_routing_order_list;
> -
> -		ret = parse_node_map(p_osm->subn.opt.guid_routing_order_file,
> -				     __guid_qlist_insert,
> -				     &list_ctx);
> -		if (!ret && cl_qlist_count(&guid_routing_order_list)) {
> -			if (__port_qlist_create(p_mgr,
> -						&guid_routing_order_list,
> -						&port_routing_order_list) < 0)
> -				goto cleanup;
> -			use_routing_order++;
> -		}
> -		else
> -			OSM_LOG(&p_osm->log, OSM_LOG_ERROR, "ERR : "
> +		if (parse_node_map(p_mgr->p_subn->opt.guid_routing_order_file,
> +				   add_guid_to_order_list, p_mgr))
> +			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR : "
>  				"cannot parse guid routing order file %s\n",
> -				p_osm->subn.opt.guid_routing_order_file);
> +				p_mgr->p_subn->opt.guid_routing_order_file);
>  	}
>  
> -	if (use_routing_order) {
> -		ctx.p_mgr = p_mgr;
> -		ctx.p_port_tbl = NULL;
> -		ctx.p_port_list = &port_routing_order_list;
> -	}
> -	else {
> -		ctx.p_mgr = p_mgr;
> -		ctx.p_port_tbl = &p_mgr->p_subn->port_guid_tbl;
> -		ctx.p_port_list = NULL;
> -	}

Entered to add_port_to_order_list from here:

> +	cl_qmap_apply_func(&p_mgr->p_subn->port_guid_tbl,
> +			   add_port_to_order_list, p_mgr);

-- Yevgeny



--
Yevgeny Kliteynik
Mellanox Technologies LTD.
SW
Phone: +972 (4) 909 7200 (ext 394)
Mobile: +972 (52) 693 0010
E-mail: kliteyn at mellanox.co.il

----------------------------------------------------------------------
Emails belong on computers, trees belong in forests; if you must print
this, do it on recycled paper.
http://www.greenpeace.org/international/
----------------------------------------------------------------------


Disclaimer added by CodeTwo Exchange Rules
http://www.codetwo.com



More information about the general mailing list