public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
To: Jim Schutt <jaschut-4OHPYypu0djtX7QSmKvirg@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v3 01/17] opensm: Prepare for routing engine input to path record SL lookup and SL2VL map setup.
Date: Wed, 7 Jul 2010 20:06:30 +0300	[thread overview]
Message-ID: <20100707170630.GN22860@me> (raw)
In-Reply-To: <1276631604-29230-2-git-send-email-jaschut-4OHPYypu0djtX7QSmKvirg@public.gmane.org>

Hi Jim,

On 13:53 Tue 15 Jun     , Jim Schutt wrote:
> diff --git a/opensm/opensm/osm_opensm.c b/opensm/opensm/osm_opensm.c
> index d3dc02e..5614240 100644
> --- a/opensm/opensm/osm_opensm.c
> +++ b/opensm/opensm/osm_opensm.c
> @@ -147,7 +147,8 @@ static void append_routing_engine(osm_opensm_t *osm,
>  	r->next = routing_engine;
>  }
>  
> -static void setup_routing_engine(osm_opensm_t *osm, const char *name)
> +static struct osm_routing_engine *setup_routing_engine(osm_opensm_t *osm,
> +						       const char *name)
>  {
>  	struct osm_routing_engine *re;
>  	const struct routing_engine_module *m;
> @@ -158,47 +159,53 @@ static void setup_routing_engine(osm_opensm_t *osm, const char *name)
>  			if (!re) {
>  				OSM_LOG(&osm->log, OSM_LOG_VERBOSE,
>  					"memory allocation failed\n");
> -				return;
> +				return NULL;
>  			}
>  			memset(re, 0, sizeof(struct osm_routing_engine));
>  
>  			re->name = m->name;
> +			re->type = osm_routing_engine_type(m->name);
>  			if (m->setup(re, osm)) {
>  				OSM_LOG(&osm->log, OSM_LOG_VERBOSE,
>  					"setup of routing"
>  					" engine \'%s\' failed\n", name);
> -				return;
> +				free(re);
> +				return NULL;
>  			}
>  			OSM_LOG(&osm->log, OSM_LOG_DEBUG,
>  				"\'%s\' routing engine set up\n", re->name);
> -			append_routing_engine(osm, re);
> -			return;
> +			if (re->type == OSM_ROUTING_ENGINE_TYPE_MINHOP)
> +				osm->default_routing_engine = re;
> +			return re;
>  		}
>  	}
>  
>  	OSM_LOG(&osm->log, OSM_LOG_ERROR,
>  		"cannot find or setup routing engine \'%s\'\n", name);
> +	return NULL;
>  }
>  
>  static void setup_routing_engines(osm_opensm_t *osm, const char *engine_names)
>  {
>  	char *name, *str, *p;
> +	struct osm_routing_engine *re;
>  
> -	if (!engine_names || !*engine_names) {
> -		setup_routing_engine(osm, "minhop");
> -		return;
> +	if (engine_names && *engine_names) {
> +		str = strdup(engine_names);
> +		name = strtok_r(str, ", \t\n", &p);
> +		while (name && *name) {
> +			re = setup_routing_engine(osm, name);
> +			if (re)
> +				append_routing_engine(osm, re);
> +			name = strtok_r(NULL, ", \t\n", &p);
> +		}
> +		free(str);
>  	}
> -
> -	str = strdup(engine_names);
> -	name = strtok_r(str, ", \t\n", &p);
> -	while (name && *name) {
> -		setup_routing_engine(osm, name);
> -		name = strtok_r(NULL, ", \t\n", &p);
> +	if (!osm->default_routing_engine) {
> +		re = setup_routing_engine(osm, "minhop");
> +		if (!osm->routing_engine_list && re)
> +			append_routing_engine(osm, re);

Shouldn't here be:

		osm->default_routing_engine = re;

too?


>  	}
> -	free(str);
> -
> -	if (!osm->routing_engine_list)
> -		setup_routing_engine(osm, "minhop");
>  }
>  
>  void osm_opensm_construct(IN osm_opensm_t * p_osm)


So that this chunk in osm_ucast_mgr_process() (below) will not break
over NULL pointer?

> -	if (p_osm->routing_engine_used == OSM_ROUTING_ENGINE_TYPE_NONE) {
> +	if (!p_osm->routing_engine_used) {
>  		/* If configured routing algorithm failed, use default MinHop */
> -		osm_ucast_mgr_build_lid_matrices(p_mgr);
> -		ucast_mgr_build_lfts(p_mgr);
> +		struct osm_routing_engine *r = p_osm->default_routing_engine;
> +
> +		r->build_lid_matrices(r->context);
> +		r->ucast_build_fwd_tables(r->context);
> +		p_osm->routing_engine_used = r;
>  		osm_ucast_mgr_set_fwd_tables(p_mgr);
> -		p_osm->routing_engine_used = OSM_ROUTING_ENGINE_TYPE_MINHOP;
>  	}

Sasha
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2010-07-07 17:06 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-15 19:53 [PATCH v3 00/17] opensm: Add new torus routing engine: torus-2QoS Jim Schutt
     [not found] ` <1276631604-29230-1-git-send-email-jaschut-4OHPYypu0djtX7QSmKvirg@public.gmane.org>
2010-06-15 19:53   ` [PATCH v3 01/17] opensm: Prepare for routing engine input to path record SL lookup and SL2VL map setup Jim Schutt
     [not found]     ` <1276631604-29230-2-git-send-email-jaschut-4OHPYypu0djtX7QSmKvirg@public.gmane.org>
2010-07-07 17:06       ` Sasha Khapyorsky [this message]
2010-07-07 17:57         ` Jim Schutt
     [not found]           ` <1278525460.4812.22.camel-mgfCWIlwujvg4c9jKm7R2O1ftBKYq+Ku@public.gmane.org>
2010-07-07 21:03             ` Sasha Khapyorsky
2010-06-15 19:53   ` [PATCH v3 02/17] opensm: Allow the routing engine to influence SL2VL calculations Jim Schutt
2010-06-15 19:53   ` [PATCH v3 03/17] opensm: Allow the routing engine to participate in path SL calculations Jim Schutt
     [not found]     ` <1276631604-29230-4-git-send-email-jaschut-4OHPYypu0djtX7QSmKvirg@public.gmane.org>
2010-07-13 18:36       ` Sasha Khapyorsky
2010-07-13 20:12         ` Jim Schutt
2010-06-15 19:53   ` [PATCH v3 04/17] opensm: Track the minimum value in the fabric of data VLs supported Jim Schutt
2010-06-15 19:53   ` [PATCH v3 05/17] opensm: Add struct osm_routing_engine callback to build spanning trees for multicast Jim Schutt
2010-06-15 19:53   ` [PATCH v3 06/17] opensm: Make mcast_mgr_purge_tree() available outside osm_mcast_mgr.c Jim Schutt
2010-06-15 19:53   ` [PATCH v3 07/17] opensm: Add torus-2QoS routing engine, part 1 Jim Schutt
2010-06-15 19:53   ` [PATCH v3 09/17] opensm: Add torus-2QoS routing engine, part 3 Jim Schutt
2010-06-15 19:53   ` [PATCH v3 10/17] opensm: Update documentation to describe torus-2QoS Jim Schutt
2010-06-15 19:53   ` [PATCH v3 11/17] opensm: Enable torus-2QoS routing engine Jim Schutt
2010-06-15 19:53   ` [PATCH v3 12/17] opensm: Add opensm option to specify file name for extra torus-2QoS configuration information Jim Schutt
2010-06-15 19:53   ` [PATCH v3 13/17] opensm: Do not require -Q option for torus-2QoS routing engine Jim Schutt
2010-06-15 19:53   ` [PATCH v3 14/17] opensm: Make it possible to configure no fallback " Jim Schutt
2010-06-15 19:53   ` [PATCH v3 15/17] opensm: Avoid havoc in minhop caused by torus-2QoS persistent use of osm_port_t:priv Jim Schutt
2010-06-15 19:53   ` [PATCH v3 16/17] opensm: Avoid havoc in dump_ucast_routes() " Jim Schutt
2010-06-15 19:53   ` [PATCH v3 17/17] opensm: Cause status of unicast routing attempt to propogate to callers of osm_ucast_mgr_process() Jim Schutt
2010-06-16 14:11   ` [PATCH v3 08/17] opensm: Add new torus routing engine: torus-2QoS, part 2 Jim Schutt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100707170630.GN22860@me \
    --to=sashak-smomgflxvozwk0htik3j/w@public.gmane.org \
    --cc=jaschut-4OHPYypu0djtX7QSmKvirg@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox