Skip to contentSkip to conversation

opensm: support routing engine update

PATCH In review Slava Strebkov 4 participants 7 messages Nov 1, 2009 – Feb 14, 2010 6 messages not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 opensm: support routing engine update

setup routing engine when in use and delete when failed. setup routing engine before use.
delete resources when routing algorithm fails.
this will save allocation for routing algorithms that are not used.

---
 opensm/include/opensm/osm_opensm.h |    5 +++
 opensm/opensm/osm_opensm.c         |   57 +++++++++++++++++++++++++++++++-----
 opensm/opensm/osm_subnet.c         |    7 ++++-
 opensm/opensm/osm_ucast_mgr.c      |   28 +++++++++++++++++
 4 files changed, 88 insertions(+), 9 deletions(-)
opensm/include/opensm/osm_opensm.h +5 -0
index c121be4..ca0fddb 100644
@@ -109,6 +109,7 @@ typedef enum _osm_routing_engine_type {
 } osm_routing_engine_type_t;
 /***********/
 
+struct osm_opensm;
 /****s* OpenSM: OpenSM/osm_routing_engine
 * NAME
 *	struct osm_routing_engine
@@ -122,6 +123,8 @@ typedef enum _osm_routing_engine_type {
 struct osm_routing_engine {
 	const char *name;
 	void *context;
+	int initialized;
+	int (*setup) (struct osm_routing_engine *re, struct osm_opensm *p_osm);
 	int (*build_lid_matrices) (void *context);
 	int (*ucast_build_fwd_tables) (void *context);
 	void (*ucast_dump_tables) (void *context);
@@ -183,6 +186,7 @@ typedef struct osm_opensm {
 	cl_dispatcher_t disp;
 	cl_plock_t lock;
 	struct osm_routing_engine *routing_engine_list;
+	struct osm_routing_engine *last_routing_engine;
 	osm_routing_engine_type_t routing_engine_used;
 	osm_stats_t stats;
 	osm_console_t console;
@@ -522,6 +526,7 @@ extern volatile unsigned int osm_exit_flag;
 * DESCRIPTION
 *  Set to one to cause all threads to leave
 *********/
+void osm_update_routing_engines(osm_opensm_t *osm, const char *engine_names);
 
 END_C_DECLS
 #endif				/* _OSM_OPENSM_H_ */
opensm/opensm/osm_opensm.c +49 -8

69 lines not on this page · raw message

opensm/opensm/osm_subnet.c +6 -1
index 8d63a75..742ae64 100644
@@ -152,6 +152,11 @@ static void opts_setup_sm_priority(osm_subn_t *p_subn, void *p_val)
 	osm_set_sm_priority(p_sm, sm_priority);
 }
 
+static void opts_setup_routing_engine(osm_subn_t *p_subn, void *p_val)
+{
+	osm_update_routing_engines(p_subn->p_osm, p_val);
+}
+
 static void opts_parse_net64(IN osm_subn_t *p_subn, IN char *p_key,
 			     IN char *p_val_str, void *p_v1, void *p_v2,
 			     void (*pfn)(osm_subn_t *, void *))
@@ -324,7 +329,7 @@ static const opt_rec_t opt_tbl[] = {
 	{ "hop_weights_file", OPT_OFFSET(hop_weights_file), opts_parse_charp, NULL, 0 },
 	{ "port_profile_switch_nodes", OPT_OFFSET(port_profile_switch_nodes), opts_parse_boolean, NULL, 1 },
 	{ "sweep_on_trap", OPT_OFFSET(sweep_on_trap), opts_parse_boolean, NULL, 1 },
-	{ "routing_engine", OPT_OFFSET(routing_engine_names), opts_parse_charp, NULL, 0 },
+	{ "routing_engine", OPT_OFFSET(routing_engine_names), opts_parse_charp, opts_setup_routing_engine, 1 },
 	{ "connect_roots", OPT_OFFSET(connect_roots), opts_parse_boolean, NULL, 1 },
 	{ "use_ucast_cache", OPT_OFFSET(use_ucast_cache), opts_parse_boolean, NULL, 1 },
 	{ "log_file", OPT_OFFSET(log_file), opts_parse_charp, NULL, 0 },
opensm/opensm/osm_ucast_mgr.c +28 -0
index 39d825c..d6294ac 100644
@@ -998,8 +998,23 @@ int osm_ucast_mgr_process(IN osm_ucast_mgr_t * p_mgr)
 
 	p_osm->routing_engine_used = OSM_ROUTING_ENGINE_TYPE_NONE;
 	while (p_routing_eng) {
+		if (!p_routing_eng->initialized &&
+			p_routing_eng->setup(p_routing_eng, p_osm)) {
+			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+				"ERR 3A0F: setup of routing engine \'%s\' failed\n",
+					p_routing_eng->name);
+					p_routing_eng = p_routing_eng->next;
+					continue;
+		}
+		OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
+			"\'%s\' routing engine set up\n", p_routing_eng->name);
+		p_routing_eng->initialized = 1;
 		if (!ucast_mgr_route(p_routing_eng, p_osm))
 			break;
+		/* delete unused routing engine */
+		if (p_routing_eng->delete)
+			p_routing_eng->delete(p_routing_eng->context);
+		p_routing_eng->initialized = 0;
 		p_routing_eng = p_routing_eng->next;
 	}
 
@@ -1011,6 +1026,19 @@ int osm_ucast_mgr_process(IN osm_ucast_mgr_t * p_mgr)
 		p_osm->routing_engine_used = OSM_ROUTING_ENGINE_TYPE_MINHOP;
 	}
 
+	/* if for some reason different routing engine is used */
+	/* cleanup last unused routing engine */
+	p_routing_eng = p_osm->last_routing_engine;
+	if (p_routing_eng) {
+			if (p_routing_eng->initialized &&
+					p_routing_eng->delete &&
+					p_osm->routing_engine_used !=
+						osm_routing_engine_type(p_routing_eng->name))
+					p_routing_eng->delete(p_routing_eng->context);
+			free(p_routing_eng);
+			p_osm->last_routing_engine = NULL;
+	}
+
 	OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
 		"%s tables configured on all switches\n",
 		osm_routing_engine_type_str(p_osm->routing_engine_used));
Signature · 6 lines
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 4AED461B.5040302-hKgKHo2Ms0F+cjeuK/[email protected]

#2 lore raw

Slava,

Quoted 4 lines · Slava Strebkov

setup routing engine when in use and delete when failed. setup routing engine before use.
delete resources when routing algorithm fails.
this will save allocation for routing algorithms that are not used.

Suppose a user runs SM with ftree & updn routings (in that order),
and SM manages to route the fabric with ftree. At some point some switch reboots and causes ftree to fail and SM routes the fabric with updn.
Does this mean that ftree will be removed from the list, and
when the switch comes back, SM won't try ftree any more?

-- Yevgeny

Quoted 183 lines
---
 opensm/include/opensm/osm_opensm.h |    5 +++
 opensm/opensm/osm_opensm.c         |   57 +++++++++++++++++++++++++++++++-----
 opensm/opensm/osm_subnet.c         |    7 ++++-
 opensm/opensm/osm_ucast_mgr.c      |   28 +++++++++++++++++
 4 files changed, 88 insertions(+), 9 deletions(-)
opensm/include/opensm/osm_opensm.h +5 -0
index c121be4..ca0fddb 100644
@@ -109,6 +109,7 @@ typedef enum _osm_routing_engine_type {
 } osm_routing_engine_type_t;
 /***********/
 
+struct osm_opensm;
 /****s* OpenSM: OpenSM/osm_routing_engine
 * NAME
 *	struct osm_routing_engine
@@ -122,6 +123,8 @@ typedef enum _osm_routing_engine_type {
 struct osm_routing_engine {
 	const char *name;
 	void *context;
+	int initialized;
+	int (*setup) (struct osm_routing_engine *re, struct osm_opensm *p_osm);
 	int (*build_lid_matrices) (void *context);
 	int (*ucast_build_fwd_tables) (void *context);
 	void (*ucast_dump_tables) (void *context);
@@ -183,6 +186,7 @@ typedef struct osm_opensm {
 	cl_dispatcher_t disp;
 	cl_plock_t lock;
 	struct osm_routing_engine *routing_engine_list;
+	struct osm_routing_engine *last_routing_engine;
 	osm_routing_engine_type_t routing_engine_used;
 	osm_stats_t stats;
 	osm_console_t console;
@@ -522,6 +526,7 @@ extern volatile unsigned int osm_exit_flag;
 * DESCRIPTION
 *  Set to one to cause all threads to leave
 *********/
+void osm_update_routing_engines(osm_opensm_t *osm, const char *engine_names);
 
 END_C_DECLS
 #endif				/* _OSM_OPENSM_H_ */
opensm/opensm/osm_opensm.c +49 -8
index 50d1349..f90584d 100644
@@ -169,14 +169,7 @@ static void setup_routing_engine(osm_opensm_t *osm, const char *name)
 			memset(re, 0, sizeof(struct osm_routing_engine));
 
 			re->name = m->name;
-			if (m->setup(re, osm)) {
-				OSM_LOG(&osm->log, OSM_LOG_VERBOSE,
-					"setup of routing"
-					" engine \'%s\' failed\n", name);
-				return;
-			}
-			OSM_LOG(&osm->log, OSM_LOG_DEBUG,
-				"\'%s\' routing engine set up\n", re->name);
+			re->setup = m->setup;
 			append_routing_engine(osm, re);
 			return;
 		}
@@ -236,6 +229,54 @@ static void destroy_routing_engines(osm_opensm_t *osm)
 			r->delete(r->context);
 		free(r);
 	}
+    osm->routing_engine_list = NULL;
+}
+
+static void update_routing_engine(
+       struct osm_routing_engine *cur,
+       struct osm_routing_engine *last)
+{
+	struct osm_routing_engine *next = cur->next;
+	if (!last)
+		return; /* no last routing engine */
+	memcpy(cur, last, sizeof(*cur));
+	/* restore next */
+	cur->next = next;
+}
+
+void osm_update_routing_engines(osm_opensm_t *osm, const char *engine_names)
+{
+	struct osm_routing_engine *r, *l;
+	/* find used routing engine and save as last */
+	l = r = osm->routing_engine_list;
+	if (r && osm->routing_engine_used == osm_routing_engine_type(r->name)) {
+		osm->last_routing_engine = r;
+		osm->routing_engine_list = r->next;
+	}
+	else while ((r = r->next)) {
+		if (osm->routing_engine_used ==
+			osm_routing_engine_type(r->name)) {
+				osm->last_routing_engine = r;
+				l->next = r->next;
+				break;
+		}
+		l = r;
+	}
+	/* cleanup prev routing engine list and replace with current list */
+	destroy_routing_engines(osm);
+	setup_routing_engines(osm, engine_names);
+	/* check if last routing engine exist in new list and update callbacks */
+	r = osm->routing_engine_list;
+	while (r) {
+		if (osm->routing_engine_used ==
+			osm_routing_engine_type(r->name)) {
+				update_routing_engine(r, osm->last_routing_engine);
+				free(osm->last_routing_engine);
+				osm->last_routing_engine = NULL;
+				break;
+		}
+	r = r->next;
+	}
 }
 
 /**********************************************************************
opensm/opensm/osm_subnet.c +6 -1
index 8d63a75..742ae64 100644
@@ -152,6 +152,11 @@ static void opts_setup_sm_priority(osm_subn_t *p_subn, void *p_val)
 	osm_set_sm_priority(p_sm, sm_priority);
 }
 
+static void opts_setup_routing_engine(osm_subn_t *p_subn, void *p_val)
+{
+	osm_update_routing_engines(p_subn->p_osm, p_val);
+}
+
 static void opts_parse_net64(IN osm_subn_t *p_subn, IN char *p_key,
 			     IN char *p_val_str, void *p_v1, void *p_v2,
 			     void (*pfn)(osm_subn_t *, void *))
@@ -324,7 +329,7 @@ static const opt_rec_t opt_tbl[] = {
 	{ "hop_weights_file", OPT_OFFSET(hop_weights_file), opts_parse_charp, NULL, 0 },
 	{ "port_profile_switch_nodes", OPT_OFFSET(port_profile_switch_nodes), opts_parse_boolean, NULL, 1 },
 	{ "sweep_on_trap", OPT_OFFSET(sweep_on_trap), opts_parse_boolean, NULL, 1 },
-	{ "routing_engine", OPT_OFFSET(routing_engine_names), opts_parse_charp, NULL, 0 },
+	{ "routing_engine", OPT_OFFSET(routing_engine_names), opts_parse_charp, opts_setup_routing_engine, 1 },
 	{ "connect_roots", OPT_OFFSET(connect_roots), opts_parse_boolean, NULL, 1 },
 	{ "use_ucast_cache", OPT_OFFSET(use_ucast_cache), opts_parse_boolean, NULL, 1 },
 	{ "log_file", OPT_OFFSET(log_file), opts_parse_charp, NULL, 0 },
opensm/opensm/osm_ucast_mgr.c +21 -0
index 39d825c..d6294ac 100644
@@ -998,8 +998,23 @@ int osm_ucast_mgr_process(IN osm_ucast_mgr_t * p_mgr)
 
 	p_osm->routing_engine_used = OSM_ROUTING_ENGINE_TYPE_NONE;
 	while (p_routing_eng) {
+		if (!p_routing_eng->initialized &&
+			p_routing_eng->setup(p_routing_eng, p_osm)) {
+			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+				"ERR 3A0F: setup of routing engine \'%s\' failed\n",
+					p_routing_eng->name);
+					p_routing_eng = p_routing_eng->next;
+					continue;
+		}
+		OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
+			"\'%s\' routing engine set up\n", p_routing_eng->name);
+		p_routing_eng->initialized = 1;
 		if (!ucast_mgr_route(p_routing_eng, p_osm))
 			break;
+		/* delete unused routing engine */
+		if (p_routing_eng->delete)
+			p_routing_eng->delete(p_routing_eng->context);
+		p_routing_eng->initialized = 0;
 		p_routing_eng = p_routing_eng->next;
 	}
 
@@ -1011,6 +1026,19 @@ int osm_ucast_mgr_process(IN osm_ucast_mgr_t * p_mgr)
 		p_osm->routing_engine_used = OSM_ROUTING_ENGINE_TYPE_MINHOP;
 	}
 
+	/* if for some reason different routing engine is used */
+	/* cleanup last unused routing engine */
+	p_routing_eng = p_osm->last_routing_engine;
+	if (p_routing_eng) {
+			if (p_routing_eng->initialized &&
+					p_routing_eng->delete &&

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * p_mgr) · line 1044

Quoted 10 lines
opensm/opensm/osm_ucast_mgr.c +7 -0
+					p_osm->routing_engine_used !=
+						osm_routing_engine_type(p_routing_eng->name))
+					p_routing_eng->delete(p_routing_eng->context);
+			free(p_routing_eng);
+			p_osm->last_routing_engine = NULL;
+	}
+
 	OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
 		"%s tables configured on all switches\n",
 		osm_routing_engine_type_str(p_osm->routing_engine_used));

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 4B1BD5B6.6000005-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org

#4 lore raw

Hi Yevgeny,
In that case SM will use updn and will not come back to ftree automatically.

Slava

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Yevgeny Kliteynik
Sent: Sunday, December 06, 2009 6:03 PM
To: Slava Strebkov
Cc: [email protected]
Subject: Re: [PATCH v3] opensm: support routing engine update

Slava,

Quoted 4 lines · Slava Strebkov

setup routing engine when in use and delete when failed. setup routing engine before use.
delete resources when routing algorithm fails.
this will save allocation for routing algorithms that are not used.

Suppose a user runs SM with ftree & updn routings (in that order), and SM manages to route the fabric with ftree. At some point some switch reboots and causes ftree to fail and SM routes the fabric with updn.
Does this mean that ftree will be removed from the list, and when the switch comes back, SM won't try ftree any more?

-- Yevgeny

Quoted 4 lines
---
 opensm/include/opensm/osm_opensm.h |    5 +++
 opensm/opensm/osm_opensm.c         |   57

+++++++++++++++++++++++++++++++-----

Review

Quoted 5 lines
 opensm/opensm/osm_subnet.c         |    7 ++++-
 opensm/opensm/osm_ucast_mgr.c      |   28 +++++++++++++++++
 4 files changed, 88 insertions(+), 9 deletions(-)
(quoted diff) +0 -0

b/opensm/include/opensm/osm_opensm.h

Quoted 12 lines

index c121be4..ca0fddb 100644

opensm/include/opensm/osm_opensm.h +1 -0
@@ -109,6 +109,7 @@ typedef enum _osm_routing_engine_type {
 } osm_routing_engine_type_t;
 /***********/
 
+struct osm_opensm;
 /****s* OpenSM: OpenSM/osm_routing_engine
 * NAME
 *	struct osm_routing_engine

opensm/include/opensm/osm_opensm.h typedef enum _osm_routing_engine_type { · line 127

Quoted 5 lines
opensm/include/opensm/osm_opensm.h +2 -0
@@ -122,6 +123,8 @@ typedef enum _osm_routing_engine_type {
 struct osm_routing_engine {
 	const char *name;
 	void *context;
+	int initialized;
+	int (*setup) (struct osm_routing_engine *re, struct osm_opensm

*p_osm);

Quoted 12 lines
opensm/include/opensm/osm_opensm.h +1 -0
 	int (*build_lid_matrices) (void *context);
 	int (*ucast_build_fwd_tables) (void *context);
 	void (*ucast_dump_tables) (void *context);
@@ -183,6 +186,7 @@ typedef struct osm_opensm {
 	cl_dispatcher_t disp;
 	cl_plock_t lock;
 	struct osm_routing_engine *routing_engine_list;
+	struct osm_routing_engine *last_routing_engine;
 	osm_routing_engine_type_t routing_engine_used;
 	osm_stats_t stats;
 	osm_console_t console;

opensm/include/opensm/osm_opensm.h extern volatile unsigned int osm_exit_flag; · line 529

Quoted 4 lines
opensm/include/opensm/osm_opensm.h +1 -0
@@ -522,6 +526,7 @@ extern volatile unsigned int osm_exit_flag;
 * DESCRIPTION
 *  Set to one to cause all threads to leave
 *********/
+void osm_update_routing_engines(osm_opensm_t *osm, const char

*engine_names);

opensm/opensm/osm_opensm.c static void setup_routing_engine(osm_opensm_t

Quoted 8 lines
opensm/include/opensm/osm_opensm.h +0 -0
 END_C_DECLS
 #endif				/* _OSM_OPENSM_H_ */
opensm/opensm/osm_opensm.c +0 -0
index 50d1349..f90584d 100644
@@ -169,14 +169,7 @@ static void setup_routing_engine(osm_opensm_t

*osm, const char *name)

opensm/opensm/osm_opensm.c static void setup_routing_engine(osm_opensm_t · line 169

Quoted 1 line
opensm/opensm/osm_opensm.c +0 -0
 			memset(re, 0, sizeof(struct

osm_routing_engine));

opensm/opensm/osm_opensm.c static void setup_routing_engine(osm_opensm_t *osm, const char *name)

Quoted 6 lines
opensm/opensm/osm_opensm.c +0 -4
 			re->name = m->name;
-			if (m->setup(re, osm)) {
-				OSM_LOG(&osm->log, OSM_LOG_VERBOSE,
-					"setup of routing"
-					" engine \'%s\' failed\n",

name);

opensm/opensm/osm_opensm.c static void setup_routing_engine(osm_opensm_t *osm, const char *name)

Quoted 4 lines
opensm/opensm/osm_opensm.c +0 -4
-				return;
-			}
-			OSM_LOG(&osm->log, OSM_LOG_DEBUG,
-				"\'%s\' routing engine set up\n",

re->name);

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t

Quoted 5 lines
opensm/opensm/osm_opensm.c +1 -0
+			re->setup = m->setup;
 			append_routing_engine(osm, re);
 			return;
 		}
@@ -236,6 +229,54 @@ static void destroy_routing_engines(osm_opensm_t

*osm)

Quoted 9 lines
opensm/opensm/osm_opensm.c +6 -0
 			r->delete(r->context);
 		free(r);
 	}
+    osm->routing_engine_list = NULL;
+}
+
+static void update_routing_engine(
+       struct osm_routing_engine *cur,
+       struct osm_routing_engine *last)

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t *osm)

Quoted 10 lines
opensm/opensm/osm_opensm.c +10 -0
+{
+	struct osm_routing_engine *next = cur->next;
+	if (!last)
+		return; /* no last routing engine */
+	memcpy(cur, last, sizeof(*cur));
+	/* restore next */
+	cur->next = next;
+}
+
+void osm_update_routing_engines(osm_opensm_t *osm, const char

*engine_names)

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t *osm)

Quoted 5 lines
opensm/opensm/osm_opensm.c +5 -0
+{
+	struct osm_routing_engine *r, *l;
+	/* find used routing engine and save as last */
+	l = r = osm->routing_engine_list;
+	if (r && osm->routing_engine_used ==

osm_routing_engine_type(r->name)) {

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t *osm)

Quoted 13 lines
opensm/opensm/osm_opensm.c +13 -0
+		osm->last_routing_engine = r;
+		osm->routing_engine_list = r->next;
+	}
+	else while ((r = r->next)) {
+		if (osm->routing_engine_used ==
+			osm_routing_engine_type(r->name)) {
+				osm->last_routing_engine = r;
+				l->next = r->next;
+				break;
+		}
+		l = r;
+	}
+	/* cleanup prev routing engine list and replace with current

list */

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t *osm)

Quoted 3 lines
opensm/opensm/osm_opensm.c +3 -0
+	destroy_routing_engines(osm);
+	setup_routing_engines(osm, engine_names);
+	/* check if last routing engine exist in new list and update

callbacks */

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t *osm)

Quoted 5 lines
opensm/opensm/osm_opensm.c +5 -0
+	r = osm->routing_engine_list;
+	while (r) {
+		if (osm->routing_engine_used ==
+			osm_routing_engine_type(r->name)) {
+				update_routing_engine(r,

osm->last_routing_engine);

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t *osm)

Quoted 9 lines
opensm/opensm/osm_opensm.c +6 -0
+				free(osm->last_routing_engine);
+				osm->last_routing_engine = NULL;
+				break;
+		}
+	r = r->next;
+	}
 }
 
 

/**********************************************************************

opensm/opensm/osm_subnet.c static void opts_setup_sm_priority(osm_subn_t

Quoted 5 lines
opensm/opensm/osm_subnet.c +0 -0
index 8d63a75..742ae64 100644
@@ -152,6 +152,11 @@ static void opts_setup_sm_priority(osm_subn_t

*p_subn, void *p_val)

opensm/opensm/osm_subnet.c static void opts_setup_sm_priority(osm_subn_t *p_subn, void *p_val)

Quoted 4 lines
opensm/opensm/osm_subnet.c +1 -0
 	osm_set_sm_priority(p_sm, sm_priority);
 }
 
+static void opts_setup_routing_engine(osm_subn_t *p_subn, void

*p_val)

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 329

Quoted 9 lines
opensm/opensm/osm_subnet.c +4 -0
+{
+	osm_update_routing_engines(p_subn->p_osm, p_val);
+}
+
 static void opts_parse_net64(IN osm_subn_t *p_subn, IN char *p_key,
 			     IN char *p_val_str, void *p_v1, void *p_v2,
 			     void (*pfn)(osm_subn_t *, void *))
@@ -324,7 +329,7 @@ static const opt_rec_t opt_tbl[] = {
 	{ "hop_weights_file", OPT_OFFSET(hop_weights_file),

opts_parse_charp, NULL, 0 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 330

Quoted 1 line
opensm/opensm/osm_subnet.c +0 -0
 	{ "port_profile_switch_nodes",

OPT_OFFSET(port_profile_switch_nodes), opts_parse_boolean, NULL, 1 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 331

Quoted 1 line
opensm/opensm/osm_subnet.c +0 -0
 	{ "sweep_on_trap", OPT_OFFSET(sweep_on_trap),

opts_parse_boolean, NULL, 1 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 327

Quoted 1 line
opensm/opensm/osm_subnet.c +0 -1
-	{ "routing_engine", OPT_OFFSET(routing_engine_names),

opts_parse_charp, NULL, 0 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 332

Quoted 1 line
opensm/opensm/osm_subnet.c +1 -0
+	{ "routing_engine", OPT_OFFSET(routing_engine_names),

opts_parse_charp, opts_setup_routing_engine, 1 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 333

Quoted 1 line
opensm/opensm/osm_subnet.c +0 -0
 	{ "connect_roots", OPT_OFFSET(connect_roots),

opts_parse_boolean, NULL, 1 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 334

Quoted 1 line
opensm/opensm/osm_subnet.c +0 -0
 	{ "use_ucast_cache", OPT_OFFSET(use_ucast_cache),

opts_parse_boolean, NULL, 1 },

Review

Quoted 2 lines
opensm/opensm/osm_subnet.c +0 -0
 	{ "log_file", OPT_OFFSET(log_file), opts_parse_charp, NULL, 0 },
(quoted diff) +0 -0

b/opensm/opensm/osm_ucast_mgr.c

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t *

Quoted 4 lines

index 39d825c..d6294ac 100644

opensm/opensm/osm_ucast_mgr.c +0 -0
@@ -998,8 +998,23 @@ int osm_ucast_mgr_process(IN osm_ucast_mgr_t *

p_mgr)

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * p_mgr)

Quoted 7 lines
opensm/opensm/osm_ucast_mgr.c +4 -0
 	p_osm->routing_engine_used = OSM_ROUTING_ENGINE_TYPE_NONE;
 	while (p_routing_eng) {
+		if (!p_routing_eng->initialized &&
+			p_routing_eng->setup(p_routing_eng, p_osm)) {
+			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+				"ERR 3A0F: setup of routing engine

\'%s\' failed\n",

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * · line 1005

Quoted 2 lines
opensm/opensm/osm_ucast_mgr.c +2 -0
+					p_routing_eng->name);
+					p_routing_eng =

p_routing_eng->next;

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * p_mgr)

Quoted 4 lines
opensm/opensm/osm_ucast_mgr.c +4 -0
+					continue;
+		}
+		OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
+			"\'%s\' routing engine set up\n",

p_routing_eng->name);

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t *

Quoted 11 lines
opensm/opensm/osm_ucast_mgr.c +5 -0
+		p_routing_eng->initialized = 1;
 		if (!ucast_mgr_route(p_routing_eng, p_osm))
 			break;
+		/* delete unused routing engine */
+		if (p_routing_eng->delete)
+			p_routing_eng->delete(p_routing_eng->context);
+		p_routing_eng->initialized = 0;
 		p_routing_eng = p_routing_eng->next;
 	}
 
@@ -1011,6 +1026,19 @@ int osm_ucast_mgr_process(IN osm_ucast_mgr_t *

p_mgr)

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * · line 1026

Quoted 1 line
opensm/opensm/osm_ucast_mgr.c +0 -0
 		p_osm->routing_engine_used =

OSM_ROUTING_ENGINE_TYPE_MINHOP;

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * p_mgr) · line 1041

Quoted 10 lines
opensm/opensm/osm_ucast_mgr.c +8 -0
 	}
 
+	/* if for some reason different routing engine is used */
+	/* cleanup last unused routing engine */
+	p_routing_eng = p_osm->last_routing_engine;
+	if (p_routing_eng) {
+			if (p_routing_eng->initialized &&
+					p_routing_eng->delete &&
+					p_osm->routing_engine_used !=
+

osm_routing_engine_type(p_routing_eng->name))

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * · line 1037

Quoted 1 line
opensm/opensm/osm_ucast_mgr.c +1 -0
+

p_routing_eng->delete(p_routing_eng->context);

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * p_mgr)

Quoted 7 lines
opensm/opensm/osm_ucast_mgr.c +4 -0
+			free(p_routing_eng);
+			p_osm->last_routing_engine = NULL;
+	}
+
 	OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
 		"%s tables configured on all switches\n",
 

osm_routing_engine_type_str(p_osm->routing_engine_used));

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 39C75744D164D948A170E9792AF8E7CA01F6FA2F-QfUkFaTmzUSUvQqKE/ONIwC/[email protected]

#6 lore raw

Slava,

Quoted 3 lines · Slava Strebkov

Hi Yevgeny,
In that case SM will use updn and will not come back to ftree automatically.

I think that this is a bad thing.

I wouldn't want *temporary* change of fabric to cause *permanent* change of SM mode of operation. Such changes do happen, and I'd prefer SM to continue functioning in accordance to the user's configuration once the fabric is settled again.

I do see the cases were the change that you propose is beneficial - if fabric topology doesn't fits the chosen routing, SM will waste time on retrying the wrong routing at every heavy sweep, but this happens due to suboptimal SM configuration and not as a result of some event that user has no control of.

-- Yevgeny

Quoted 254 lines

Slava

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Yevgeny Kliteynik
Sent: Sunday, December 06, 2009 6:03 PM
To: Slava Strebkov
Cc: [email protected]
Subject: Re: [PATCH v3] opensm: support routing engine update

Slava,

Quoted 4 lines · Slava Strebkov

setup routing engine when in use and delete when failed. setup routing engine before use.
delete resources when routing algorithm fails.
this will save allocation for routing algorithms that are not used.

Suppose a user runs SM with ftree & updn routings (in that order),
and SM manages to route the fabric with ftree. At some point some switch reboots and causes ftree to fail and SM routes the fabric with updn.
Does this mean that ftree will be removed from the list, and
when the switch comes back, SM won't try ftree any more?

-- Yevgeny

Quoted 4 lines
---
 opensm/include/opensm/osm_opensm.h |    5 +++
 opensm/opensm/osm_opensm.c         |   57

+++++++++++++++++++++++++++++++-----

Review

Quoted 5 lines
 opensm/opensm/osm_subnet.c         |    7 ++++-
 opensm/opensm/osm_ucast_mgr.c      |   28 +++++++++++++++++
 4 files changed, 88 insertions(+), 9 deletions(-)
(quoted diff) +0 -0

b/opensm/include/opensm/osm_opensm.h

Quoted 12 lines

index c121be4..ca0fddb 100644

opensm/include/opensm/osm_opensm.h +1 -0
@@ -109,6 +109,7 @@ typedef enum _osm_routing_engine_type {
 } osm_routing_engine_type_t;
 /***********/
 
+struct osm_opensm;
 /****s* OpenSM: OpenSM/osm_routing_engine
 * NAME
 *	struct osm_routing_engine

opensm/include/opensm/osm_opensm.h typedef enum _osm_routing_engine_type { · line 127

Quoted 5 lines
opensm/include/opensm/osm_opensm.h +2 -0
@@ -122,6 +123,8 @@ typedef enum _osm_routing_engine_type {
 struct osm_routing_engine {
 	const char *name;
 	void *context;
+	int initialized;
+	int (*setup) (struct osm_routing_engine *re, struct osm_opensm

*p_osm);

Quoted 12 lines
opensm/include/opensm/osm_opensm.h +1 -0
 	int (*build_lid_matrices) (void *context);
 	int (*ucast_build_fwd_tables) (void *context);
 	void (*ucast_dump_tables) (void *context);
@@ -183,6 +186,7 @@ typedef struct osm_opensm {
 	cl_dispatcher_t disp;
 	cl_plock_t lock;
 	struct osm_routing_engine *routing_engine_list;
+	struct osm_routing_engine *last_routing_engine;
 	osm_routing_engine_type_t routing_engine_used;
 	osm_stats_t stats;
 	osm_console_t console;

opensm/include/opensm/osm_opensm.h extern volatile unsigned int osm_exit_flag; · line 529

Quoted 4 lines
opensm/include/opensm/osm_opensm.h +1 -0
@@ -522,6 +526,7 @@ extern volatile unsigned int osm_exit_flag;
 * DESCRIPTION
 *  Set to one to cause all threads to leave
 *********/
+void osm_update_routing_engines(osm_opensm_t *osm, const char

*engine_names);

opensm/opensm/osm_opensm.c static void setup_routing_engine(osm_opensm_t

Quoted 8 lines
opensm/include/opensm/osm_opensm.h +0 -0
 END_C_DECLS
 #endif				/* _OSM_OPENSM_H_ */
opensm/opensm/osm_opensm.c +0 -0
index 50d1349..f90584d 100644
@@ -169,14 +169,7 @@ static void setup_routing_engine(osm_opensm_t

*osm, const char *name)

opensm/opensm/osm_opensm.c static void setup_routing_engine(osm_opensm_t · line 169

Quoted 1 line
opensm/opensm/osm_opensm.c +0 -0
 			memset(re, 0, sizeof(struct

osm_routing_engine));

opensm/opensm/osm_opensm.c static void setup_routing_engine(osm_opensm_t *osm, const char *name)

Quoted 6 lines
opensm/opensm/osm_opensm.c +0 -4
 			re->name = m->name;
-			if (m->setup(re, osm)) {
-				OSM_LOG(&osm->log, OSM_LOG_VERBOSE,
-					"setup of routing"
-					" engine \'%s\' failed\n",

name);

opensm/opensm/osm_opensm.c static void setup_routing_engine(osm_opensm_t *osm, const char *name)

Quoted 4 lines
opensm/opensm/osm_opensm.c +0 -4
-				return;
-			}
-			OSM_LOG(&osm->log, OSM_LOG_DEBUG,
-				"\'%s\' routing engine set up\n",

re->name);

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t

Quoted 5 lines
opensm/opensm/osm_opensm.c +1 -0
+			re->setup = m->setup;
 			append_routing_engine(osm, re);
 			return;
 		}
@@ -236,6 +229,54 @@ static void destroy_routing_engines(osm_opensm_t

*osm)

Quoted 9 lines
opensm/opensm/osm_opensm.c +6 -0
 			r->delete(r->context);
 		free(r);
 	}
+    osm->routing_engine_list = NULL;
+}
+
+static void update_routing_engine(
+       struct osm_routing_engine *cur,
+       struct osm_routing_engine *last)

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t *osm)

Quoted 10 lines
opensm/opensm/osm_opensm.c +10 -0
+{
+	struct osm_routing_engine *next = cur->next;
+	if (!last)
+		return; /* no last routing engine */
+	memcpy(cur, last, sizeof(*cur));
+	/* restore next */
+	cur->next = next;
+}
+
+void osm_update_routing_engines(osm_opensm_t *osm, const char

*engine_names)

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t *osm)

Quoted 5 lines
opensm/opensm/osm_opensm.c +5 -0
+{
+	struct osm_routing_engine *r, *l;
+	/* find used routing engine and save as last */
+	l = r = osm->routing_engine_list;
+	if (r && osm->routing_engine_used ==

osm_routing_engine_type(r->name)) {

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t *osm)

Quoted 13 lines
opensm/opensm/osm_opensm.c +13 -0
+		osm->last_routing_engine = r;
+		osm->routing_engine_list = r->next;
+	}
+	else while ((r = r->next)) {
+		if (osm->routing_engine_used ==
+			osm_routing_engine_type(r->name)) {
+				osm->last_routing_engine = r;
+				l->next = r->next;
+				break;
+		}
+		l = r;
+	}
+	/* cleanup prev routing engine list and replace with current

list */

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t *osm)

Quoted 3 lines
opensm/opensm/osm_opensm.c +3 -0
+	destroy_routing_engines(osm);
+	setup_routing_engines(osm, engine_names);
+	/* check if last routing engine exist in new list and update

callbacks */

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t *osm)

Quoted 5 lines
opensm/opensm/osm_opensm.c +5 -0
+	r = osm->routing_engine_list;
+	while (r) {
+		if (osm->routing_engine_used ==
+			osm_routing_engine_type(r->name)) {
+				update_routing_engine(r,

osm->last_routing_engine);

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t *osm)

Quoted 9 lines
opensm/opensm/osm_opensm.c +6 -0
+				free(osm->last_routing_engine);
+				osm->last_routing_engine = NULL;
+				break;
+		}
+	r = r->next;
+	}
 }
 
 

/**********************************************************************

opensm/opensm/osm_subnet.c static void opts_setup_sm_priority(osm_subn_t

Quoted 5 lines
opensm/opensm/osm_subnet.c +0 -0
index 8d63a75..742ae64 100644
@@ -152,6 +152,11 @@ static void opts_setup_sm_priority(osm_subn_t

*p_subn, void *p_val)

opensm/opensm/osm_subnet.c static void opts_setup_sm_priority(osm_subn_t *p_subn, void *p_val)

Quoted 4 lines
opensm/opensm/osm_subnet.c +1 -0
 	osm_set_sm_priority(p_sm, sm_priority);
 }
 
+static void opts_setup_routing_engine(osm_subn_t *p_subn, void

*p_val)

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 329

Quoted 9 lines
opensm/opensm/osm_subnet.c +4 -0
+{
+	osm_update_routing_engines(p_subn->p_osm, p_val);
+}
+
 static void opts_parse_net64(IN osm_subn_t *p_subn, IN char *p_key,
 			     IN char *p_val_str, void *p_v1, void *p_v2,
 			     void (*pfn)(osm_subn_t *, void *))
@@ -324,7 +329,7 @@ static const opt_rec_t opt_tbl[] = {
 	{ "hop_weights_file", OPT_OFFSET(hop_weights_file),

opts_parse_charp, NULL, 0 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 330

Quoted 1 line
opensm/opensm/osm_subnet.c +0 -0
 	{ "port_profile_switch_nodes",

OPT_OFFSET(port_profile_switch_nodes), opts_parse_boolean, NULL, 1 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 331

Quoted 1 line
opensm/opensm/osm_subnet.c +0 -0
 	{ "sweep_on_trap", OPT_OFFSET(sweep_on_trap),

opts_parse_boolean, NULL, 1 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 327

Quoted 1 line
opensm/opensm/osm_subnet.c +0 -1
-	{ "routing_engine", OPT_OFFSET(routing_engine_names),

opts_parse_charp, NULL, 0 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 332

Quoted 1 line
opensm/opensm/osm_subnet.c +1 -0
+	{ "routing_engine", OPT_OFFSET(routing_engine_names),

opts_parse_charp, opts_setup_routing_engine, 1 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 333

Quoted 1 line
opensm/opensm/osm_subnet.c +0 -0
 	{ "connect_roots", OPT_OFFSET(connect_roots),

opts_parse_boolean, NULL, 1 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 334

Quoted 1 line
opensm/opensm/osm_subnet.c +0 -0
 	{ "use_ucast_cache", OPT_OFFSET(use_ucast_cache),

opts_parse_boolean, NULL, 1 },

Review

Quoted 2 lines
opensm/opensm/osm_subnet.c +0 -0
 	{ "log_file", OPT_OFFSET(log_file), opts_parse_charp, NULL, 0 },
(quoted diff) +0 -0

b/opensm/opensm/osm_ucast_mgr.c

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t *

Quoted 4 lines

index 39d825c..d6294ac 100644

opensm/opensm/osm_ucast_mgr.c +0 -0
@@ -998,8 +998,23 @@ int osm_ucast_mgr_process(IN osm_ucast_mgr_t *

p_mgr)

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * p_mgr)

Quoted 7 lines
opensm/opensm/osm_ucast_mgr.c +4 -0
 	p_osm->routing_engine_used = OSM_ROUTING_ENGINE_TYPE_NONE;
 	while (p_routing_eng) {
+		if (!p_routing_eng->initialized &&
+			p_routing_eng->setup(p_routing_eng, p_osm)) {
+			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+				"ERR 3A0F: setup of routing engine

\'%s\' failed\n",

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * · line 1005

Quoted 2 lines
opensm/opensm/osm_ucast_mgr.c +2 -0
+					p_routing_eng->name);
+					p_routing_eng =

p_routing_eng->next;

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * p_mgr)

Quoted 4 lines
opensm/opensm/osm_ucast_mgr.c +4 -0
+					continue;
+		}
+		OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
+			"\'%s\' routing engine set up\n",

p_routing_eng->name);

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t *

Quoted 11 lines
opensm/opensm/osm_ucast_mgr.c +5 -0
+		p_routing_eng->initialized = 1;
 		if (!ucast_mgr_route(p_routing_eng, p_osm))
 			break;
+		/* delete unused routing engine */
+		if (p_routing_eng->delete)
+			p_routing_eng->delete(p_routing_eng->context);
+		p_routing_eng->initialized = 0;
 		p_routing_eng = p_routing_eng->next;
 	}
 
@@ -1011,6 +1026,19 @@ int osm_ucast_mgr_process(IN osm_ucast_mgr_t *

p_mgr)

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * · line 1026

Quoted 1 line
opensm/opensm/osm_ucast_mgr.c +0 -0
 		p_osm->routing_engine_used =

OSM_ROUTING_ENGINE_TYPE_MINHOP;

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * p_mgr) · line 1041

Quoted 10 lines
opensm/opensm/osm_ucast_mgr.c +8 -0
 	}
 
+	/* if for some reason different routing engine is used */
+	/* cleanup last unused routing engine */
+	p_routing_eng = p_osm->last_routing_engine;
+	if (p_routing_eng) {
+			if (p_routing_eng->initialized &&
+					p_routing_eng->delete &&
+					p_osm->routing_engine_used !=
+

osm_routing_engine_type(p_routing_eng->name))

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * · line 1037

Quoted 1 line
opensm/opensm/osm_ucast_mgr.c +1 -0
+

p_routing_eng->delete(p_routing_eng->context);

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * p_mgr)

Quoted 7 lines
opensm/opensm/osm_ucast_mgr.c +4 -0
+			free(p_routing_eng);
+			p_osm->last_routing_engine = NULL;
+	}
+
 	OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
 		"%s tables configured on all switches\n",
 

osm_routing_engine_type_str(p_osm->routing_engine_used));

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 4B1CBB34.6070708-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org

#8 lore raw

HI!
That was my misunderstanding - upon heavy sweep SM will try to load routing engines as defined in the SM.conf file (ftree & updn - in that order).
So ftree will be loaded when switch comes back from reboot.

Slava

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Yevgeny Kliteynik
Sent: Monday, December 07, 2009 10:22 AM
To: Slava Strebkov
Cc: [email protected]
Subject: Re: [PATCH v3] opensm: support routing engine update

Slava,

Quoted 3 lines · Slava Strebkov

Hi Yevgeny,
In that case SM will use updn and will not come back to ftree automatically.

I think that this is a bad thing.

I wouldn't want *temporary* change of fabric to cause *permanent* change of SM mode of operation. Such changes do happen, and I'd prefer SM to continue functioning in accordance to the user's configuration once the fabric is settled again.

I do see the cases were the change that you propose is beneficial - if fabric topology doesn't fits the chosen routing, SM will waste time on retrying the wrong routing at every heavy sweep, but this happens due to suboptimal SM configuration and not as a result of some event that user has no control of.

-- Yevgeny

Quoted 5 lines

Slava

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Yevgeny

Kliteynik

Quoted 147 lines

Sent: Sunday, December 06, 2009 6:03 PM
To: Slava Strebkov
Cc: [email protected]
Subject: Re: [PATCH v3] opensm: support routing engine update

Slava,

Quoted 4 lines · Slava Strebkov

setup routing engine when in use and delete when failed. setup routing engine before use.
delete resources when routing algorithm fails.
this will save allocation for routing algorithms that are not used.

Suppose a user runs SM with ftree & updn routings (in that order), and SM manages to route the fabric with ftree. At some point some switch reboots and causes ftree to fail and SM routes the fabric with updn.
Does this mean that ftree will be removed from the list, and when the switch comes back, SM won't try ftree any more?

-- Yevgeny

Quoted 4 lines
---
 opensm/include/opensm/osm_opensm.h |    5 +++
 opensm/opensm/osm_opensm.c         |   57

+++++++++++++++++++++++++++++++-----

Review

Quoted 5 lines
 opensm/opensm/osm_subnet.c         |    7 ++++-
 opensm/opensm/osm_ucast_mgr.c      |   28 +++++++++++++++++
 4 files changed, 88 insertions(+), 9 deletions(-)
(quoted diff) +0 -0

b/opensm/include/opensm/osm_opensm.h

Quoted 12 lines

index c121be4..ca0fddb 100644

opensm/include/opensm/osm_opensm.h +1 -0
@@ -109,6 +109,7 @@ typedef enum _osm_routing_engine_type {
 } osm_routing_engine_type_t;
 /***********/
 
+struct osm_opensm;
 /****s* OpenSM: OpenSM/osm_routing_engine
 * NAME
 *	struct osm_routing_engine

opensm/include/opensm/osm_opensm.h typedef enum _osm_routing_engine_type { · line 127

Quoted 5 lines
opensm/include/opensm/osm_opensm.h +2 -0
@@ -122,6 +123,8 @@ typedef enum _osm_routing_engine_type {
 struct osm_routing_engine {
 	const char *name;
 	void *context;
+	int initialized;
+	int (*setup) (struct osm_routing_engine *re, struct osm_opensm

*p_osm);

Quoted 12 lines
opensm/include/opensm/osm_opensm.h +1 -0
 	int (*build_lid_matrices) (void *context);
 	int (*ucast_build_fwd_tables) (void *context);
 	void (*ucast_dump_tables) (void *context);
@@ -183,6 +186,7 @@ typedef struct osm_opensm {
 	cl_dispatcher_t disp;
 	cl_plock_t lock;
 	struct osm_routing_engine *routing_engine_list;
+	struct osm_routing_engine *last_routing_engine;
 	osm_routing_engine_type_t routing_engine_used;
 	osm_stats_t stats;
 	osm_console_t console;

opensm/include/opensm/osm_opensm.h extern volatile unsigned int osm_exit_flag; · line 529

Quoted 4 lines
opensm/include/opensm/osm_opensm.h +1 -0
@@ -522,6 +526,7 @@ extern volatile unsigned int osm_exit_flag;
 * DESCRIPTION
 *  Set to one to cause all threads to leave
 *********/
+void osm_update_routing_engines(osm_opensm_t *osm, const char

*engine_names);

opensm/opensm/osm_opensm.c static void setup_routing_engine(osm_opensm_t

Quoted 8 lines
opensm/include/opensm/osm_opensm.h +0 -0
 END_C_DECLS
 #endif				/* _OSM_OPENSM_H_ */
opensm/opensm/osm_opensm.c +0 -0
index 50d1349..f90584d 100644
@@ -169,14 +169,7 @@ static void setup_routing_engine(osm_opensm_t

*osm, const char *name)

opensm/opensm/osm_opensm.c static void setup_routing_engine(osm_opensm_t · line 169

Quoted 1 line
opensm/opensm/osm_opensm.c +0 -0
 			memset(re, 0, sizeof(struct

osm_routing_engine));

opensm/opensm/osm_opensm.c static void setup_routing_engine(osm_opensm_t · line 174

Quoted 6 lines
opensm/opensm/osm_opensm.c +0 -4
 			re->name = m->name;
-			if (m->setup(re, osm)) {
-				OSM_LOG(&osm->log, OSM_LOG_VERBOSE,
-					"setup of routing"
-					" engine \'%s\' failed\n",

name);

opensm/opensm/osm_opensm.c static void setup_routing_engine(osm_opensm_t · line 178

Quoted 4 lines
opensm/opensm/osm_opensm.c +0 -4
-				return;
-			}
-			OSM_LOG(&osm->log, OSM_LOG_DEBUG,
-				"\'%s\' routing engine set up\n",

re->name);

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t

Quoted 5 lines
opensm/opensm/osm_opensm.c +1 -0
+			re->setup = m->setup;
 			append_routing_engine(osm, re);
 			return;
 		}
@@ -236,6 +229,54 @@ static void destroy_routing_engines(osm_opensm_t

*osm)

Quoted 9 lines
opensm/opensm/osm_opensm.c +6 -0
 			r->delete(r->context);
 		free(r);
 	}
+    osm->routing_engine_list = NULL;
+}
+
+static void update_routing_engine(
+       struct osm_routing_engine *cur,
+       struct osm_routing_engine *last)

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t · line 247

Quoted 10 lines
opensm/opensm/osm_opensm.c +10 -0
+{
+	struct osm_routing_engine *next = cur->next;
+	if (!last)
+		return; /* no last routing engine */
+	memcpy(cur, last, sizeof(*cur));
+	/* restore next */
+	cur->next = next;
+}
+
+void osm_update_routing_engines(osm_opensm_t *osm, const char

*engine_names)

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t · line 252

Quoted 5 lines
opensm/opensm/osm_opensm.c +5 -0
+{
+	struct osm_routing_engine *r, *l;
+	/* find used routing engine and save as last */
+	l = r = osm->routing_engine_list;
+	if (r && osm->routing_engine_used ==

osm_routing_engine_type(r->name)) {

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t · line 265

Quoted 13 lines
opensm/opensm/osm_opensm.c +13 -0
+		osm->last_routing_engine = r;
+		osm->routing_engine_list = r->next;
+	}
+	else while ((r = r->next)) {
+		if (osm->routing_engine_used ==
+			osm_routing_engine_type(r->name)) {
+				osm->last_routing_engine = r;
+				l->next = r->next;
+				break;
+		}
+		l = r;
+	}
+	/* cleanup prev routing engine list and replace with current

list */

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t · line 268

Quoted 3 lines
opensm/opensm/osm_opensm.c +3 -0
+	destroy_routing_engines(osm);
+	setup_routing_engines(osm, engine_names);
+	/* check if last routing engine exist in new list and update

callbacks */

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t · line 273

Quoted 5 lines
opensm/opensm/osm_opensm.c +5 -0
+	r = osm->routing_engine_list;
+	while (r) {
+		if (osm->routing_engine_used ==
+			osm_routing_engine_type(r->name)) {
+				update_routing_engine(r,

osm->last_routing_engine);

Quoted 10 lines

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t · line 282

Quoted 9 lines
opensm/opensm/osm_opensm.c +6 -0
+				free(osm->last_routing_engine);
+				osm->last_routing_engine = NULL;
+				break;
+		}
+	r = r->next;
+	}
 }
 
 

/**********************************************************************

Quoted 93 lines

opensm/opensm/osm_subnet.c static void opts_setup_sm_priority(osm_subn_t

Quoted 5 lines
opensm/opensm/osm_subnet.c +0 -0
index 8d63a75..742ae64 100644
@@ -152,6 +152,11 @@ static void opts_setup_sm_priority(osm_subn_t

*p_subn, void *p_val)

opensm/opensm/osm_subnet.c static void opts_setup_sm_priority(osm_subn_t · line 155

Quoted 4 lines
opensm/opensm/osm_subnet.c +1 -0
 	osm_set_sm_priority(p_sm, sm_priority);
 }
 
+static void opts_setup_routing_engine(osm_subn_t *p_subn, void

*p_val)

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 329

Quoted 9 lines
opensm/opensm/osm_subnet.c +4 -0
+{
+	osm_update_routing_engines(p_subn->p_osm, p_val);
+}
+
 static void opts_parse_net64(IN osm_subn_t *p_subn, IN char *p_key,
 			     IN char *p_val_str, void *p_v1, void *p_v2,
 			     void (*pfn)(osm_subn_t *, void *))
@@ -324,7 +329,7 @@ static const opt_rec_t opt_tbl[] = {
 	{ "hop_weights_file", OPT_OFFSET(hop_weights_file),

opts_parse_charp, NULL, 0 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 330

Quoted 1 line
opensm/opensm/osm_subnet.c +0 -0
 	{ "port_profile_switch_nodes",

OPT_OFFSET(port_profile_switch_nodes), opts_parse_boolean, NULL, 1 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 331

Quoted 1 line
opensm/opensm/osm_subnet.c +0 -0
 	{ "sweep_on_trap", OPT_OFFSET(sweep_on_trap),

opts_parse_boolean, NULL, 1 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 327

Quoted 1 line
opensm/opensm/osm_subnet.c +0 -1
-	{ "routing_engine", OPT_OFFSET(routing_engine_names),

opts_parse_charp, NULL, 0 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 332

Quoted 1 line
opensm/opensm/osm_subnet.c +1 -0
+	{ "routing_engine", OPT_OFFSET(routing_engine_names),

opts_parse_charp, opts_setup_routing_engine, 1 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 333

Quoted 1 line
opensm/opensm/osm_subnet.c +0 -0
 	{ "connect_roots", OPT_OFFSET(connect_roots),

opts_parse_boolean, NULL, 1 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 334

Quoted 1 line
opensm/opensm/osm_subnet.c +0 -0
 	{ "use_ucast_cache", OPT_OFFSET(use_ucast_cache),

opts_parse_boolean, NULL, 1 },

Review

Quoted 2 lines
opensm/opensm/osm_subnet.c +0 -0
 	{ "log_file", OPT_OFFSET(log_file), opts_parse_charp, NULL, 0 },
(quoted diff) +0 -0

b/opensm/opensm/osm_ucast_mgr.c

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t *

Quoted 4 lines

index 39d825c..d6294ac 100644

opensm/opensm/osm_ucast_mgr.c +0 -0
@@ -998,8 +998,23 @@ int osm_ucast_mgr_process(IN osm_ucast_mgr_t *

p_mgr)

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * · line 1003

Quoted 7 lines
opensm/opensm/osm_ucast_mgr.c +4 -0
 	p_osm->routing_engine_used = OSM_ROUTING_ENGINE_TYPE_NONE;
 	while (p_routing_eng) {
+		if (!p_routing_eng->initialized &&
+			p_routing_eng->setup(p_routing_eng, p_osm)) {
+			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+				"ERR 3A0F: setup of routing engine

\'%s\' failed\n",

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * · line 1005

Quoted 2 lines
opensm/opensm/osm_ucast_mgr.c +2 -0
+					p_routing_eng->name);
+					p_routing_eng =

p_routing_eng->next;

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * · line 1009

Quoted 4 lines
opensm/opensm/osm_ucast_mgr.c +4 -0
+					continue;
+		}
+		OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
+			"\'%s\' routing engine set up\n",

p_routing_eng->name);

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t *

Quoted 11 lines
opensm/opensm/osm_ucast_mgr.c +5 -0
+		p_routing_eng->initialized = 1;
 		if (!ucast_mgr_route(p_routing_eng, p_osm))
 			break;
+		/* delete unused routing engine */
+		if (p_routing_eng->delete)
+			p_routing_eng->delete(p_routing_eng->context);
+		p_routing_eng->initialized = 0;
 		p_routing_eng = p_routing_eng->next;
 	}
 
@@ -1011,6 +1026,19 @@ int osm_ucast_mgr_process(IN osm_ucast_mgr_t *

p_mgr)

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * · line 1026

Quoted 1 line
opensm/opensm/osm_ucast_mgr.c +0 -0
 		p_osm->routing_engine_used =

OSM_ROUTING_ENGINE_TYPE_MINHOP;

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * · line 1036

Quoted 10 lines
opensm/opensm/osm_ucast_mgr.c +8 -0
 	}
 
+	/* if for some reason different routing engine is used */
+	/* cleanup last unused routing engine */
+	p_routing_eng = p_osm->last_routing_engine;
+	if (p_routing_eng) {
+			if (p_routing_eng->initialized &&
+					p_routing_eng->delete &&
+					p_osm->routing_engine_used !=
+

osm_routing_engine_type(p_routing_eng->name))

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * · line 1037

Quoted 1 line
opensm/opensm/osm_ucast_mgr.c +1 -0
+

p_routing_eng->delete(p_routing_eng->context);

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * · line 1044

Quoted 7 lines
opensm/opensm/osm_ucast_mgr.c +4 -0
+			free(p_routing_eng);
+			p_osm->last_routing_engine = NULL;
+	}
+
 	OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
 		"%s tables configured on all switches\n",
 

osm_routing_engine_type_str(p_osm->routing_engine_used));

Quoted 2 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma"

in

Quoted 3 lines

the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 39C75744D164D948A170E9792AF8E7CA01F6FA30-QfUkFaTmzUSUvQqKE/ONIwC/[email protected]

#10 lore raw
Quoted 31 lines · Slava Strebkov

HI!
That was my misunderstanding - upon heavy sweep SM will try to load routing engines as defined in the SM.conf file (ftree & updn - in that order).
So ftree will be loaded when switch comes back from reboot.

Slava

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Yevgeny Kliteynik
Sent: Monday, December 07, 2009 10:22 AM
To: Slava Strebkov
Cc: [email protected]
Subject: Re: [PATCH v3] opensm: support routing engine update

Slava,

Quoted 3 lines · Slava Strebkov

Hi Yevgeny,
In that case SM will use updn and will not come back to ftree automatically.

I think that this is a bad thing.

I wouldn't want *temporary* change of fabric to cause *permanent* change of SM mode of operation. Such changes do happen, and I'd prefer SM to continue functioning in accordance to the user's configuration once the fabric is settled again.

Quoted 6 lines

I do see the cases were the change that you propose is beneficial - if fabric topology doesn't fits the chosen routing, SM will waste time on retrying the wrong routing at every heavy sweep, but this happens due to suboptimal SM configuration and not as a result of some event that user has no control of.

For every heavy sweep the SM will try to configure the routing engines as specified in the conf file. So when a switch goes up and ftree configuration is valid, the SM will configure ftree instead of updn.

Eli

Quoted 267 lines

-- Yevgeny

Quoted 5 lines

Slava

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Yevgeny

Kliteynik

Quoted 146 lines

Sent: Sunday, December 06, 2009 6:03 PM
To: Slava Strebkov
Cc: [email protected]
Subject: Re: [PATCH v3] opensm: support routing engine update

Slava,

Quoted 4 lines · Slava Strebkov

setup routing engine when in use and delete when failed. setup routing engine before use.
delete resources when routing algorithm fails.
this will save allocation for routing algorithms that are not used.

Suppose a user runs SM with ftree & updn routings (in that order), and SM manages to route the fabric with ftree. At some point some switch reboots and causes ftree to fail and SM routes the fabric with updn.
Does this mean that ftree will be removed from the list, and when the switch comes back, SM won't try ftree any more?

-- Yevgeny

Quoted 4 lines
---
 opensm/include/opensm/osm_opensm.h |    5 +++
 opensm/opensm/osm_opensm.c         |   57

+++++++++++++++++++++++++++++++-----

Review

Quoted 5 lines
 opensm/opensm/osm_subnet.c         |    7 ++++-
 opensm/opensm/osm_ucast_mgr.c      |   28 +++++++++++++++++
 4 files changed, 88 insertions(+), 9 deletions(-)
(quoted diff) +0 -0

b/opensm/include/opensm/osm_opensm.h

Quoted 12 lines

index c121be4..ca0fddb 100644

opensm/include/opensm/osm_opensm.h +1 -0
@@ -109,6 +109,7 @@ typedef enum _osm_routing_engine_type {
 } osm_routing_engine_type_t;
 /***********/
 
+struct osm_opensm;
 /****s* OpenSM: OpenSM/osm_routing_engine
 * NAME
 *	struct osm_routing_engine

opensm/include/opensm/osm_opensm.h typedef enum _osm_routing_engine_type { · line 127

Quoted 5 lines
opensm/include/opensm/osm_opensm.h +2 -0
@@ -122,6 +123,8 @@ typedef enum _osm_routing_engine_type {
 struct osm_routing_engine {
 	const char *name;
 	void *context;
+	int initialized;
+	int (*setup) (struct osm_routing_engine *re, struct osm_opensm

*p_osm);

Quoted 12 lines
opensm/include/opensm/osm_opensm.h +1 -0
 	int (*build_lid_matrices) (void *context);
 	int (*ucast_build_fwd_tables) (void *context);
 	void (*ucast_dump_tables) (void *context);
@@ -183,6 +186,7 @@ typedef struct osm_opensm {
 	cl_dispatcher_t disp;
 	cl_plock_t lock;
 	struct osm_routing_engine *routing_engine_list;
+	struct osm_routing_engine *last_routing_engine;
 	osm_routing_engine_type_t routing_engine_used;
 	osm_stats_t stats;
 	osm_console_t console;

opensm/include/opensm/osm_opensm.h extern volatile unsigned int osm_exit_flag; · line 529

Quoted 4 lines
opensm/include/opensm/osm_opensm.h +1 -0
@@ -522,6 +526,7 @@ extern volatile unsigned int osm_exit_flag;
 * DESCRIPTION
 *  Set to one to cause all threads to leave
 *********/
+void osm_update_routing_engines(osm_opensm_t *osm, const char

*engine_names);

opensm/opensm/osm_opensm.c static void setup_routing_engine(osm_opensm_t

Quoted 8 lines
opensm/include/opensm/osm_opensm.h +0 -0
 END_C_DECLS
 #endif				/* _OSM_OPENSM_H_ */
opensm/opensm/osm_opensm.c +0 -0
index 50d1349..f90584d 100644
@@ -169,14 +169,7 @@ static void setup_routing_engine(osm_opensm_t

*osm, const char *name)

opensm/opensm/osm_opensm.c static void setup_routing_engine(osm_opensm_t · line 169

Quoted 1 line
opensm/opensm/osm_opensm.c +0 -0
 			memset(re, 0, sizeof(struct

osm_routing_engine));

opensm/opensm/osm_opensm.c static void setup_routing_engine(osm_opensm_t · line 174

Quoted 6 lines
opensm/opensm/osm_opensm.c +0 -4
 			re->name = m->name;
-			if (m->setup(re, osm)) {
-				OSM_LOG(&osm->log, OSM_LOG_VERBOSE,
-					"setup of routing"
-					" engine \'%s\' failed\n",

name);

opensm/opensm/osm_opensm.c static void setup_routing_engine(osm_opensm_t · line 178

Quoted 4 lines
opensm/opensm/osm_opensm.c +0 -4
-				return;
-			}
-			OSM_LOG(&osm->log, OSM_LOG_DEBUG,
-				"\'%s\' routing engine set up\n",

re->name);

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t

Quoted 5 lines
opensm/opensm/osm_opensm.c +1 -0
+			re->setup = m->setup;
 			append_routing_engine(osm, re);
 			return;
 		}
@@ -236,6 +229,54 @@ static void destroy_routing_engines(osm_opensm_t

*osm)

Quoted 9 lines
opensm/opensm/osm_opensm.c +6 -0
 			r->delete(r->context);
 		free(r);
 	}
+    osm->routing_engine_list = NULL;
+}
+
+static void update_routing_engine(
+       struct osm_routing_engine *cur,
+       struct osm_routing_engine *last)

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t · line 247

Quoted 10 lines
opensm/opensm/osm_opensm.c +10 -0
+{
+	struct osm_routing_engine *next = cur->next;
+	if (!last)
+		return; /* no last routing engine */
+	memcpy(cur, last, sizeof(*cur));
+	/* restore next */
+	cur->next = next;
+}
+
+void osm_update_routing_engines(osm_opensm_t *osm, const char

*engine_names)

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t · line 252

Quoted 5 lines
opensm/opensm/osm_opensm.c +5 -0
+{
+	struct osm_routing_engine *r, *l;
+	/* find used routing engine and save as last */
+	l = r = osm->routing_engine_list;
+	if (r && osm->routing_engine_used ==

osm_routing_engine_type(r->name)) {

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t · line 265

Quoted 13 lines
opensm/opensm/osm_opensm.c +13 -0
+		osm->last_routing_engine = r;
+		osm->routing_engine_list = r->next;
+	}
+	else while ((r = r->next)) {
+		if (osm->routing_engine_used ==
+			osm_routing_engine_type(r->name)) {
+				osm->last_routing_engine = r;
+				l->next = r->next;
+				break;
+		}
+		l = r;
+	}
+	/* cleanup prev routing engine list and replace with current

list */

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t · line 268

Quoted 3 lines
opensm/opensm/osm_opensm.c +3 -0
+	destroy_routing_engines(osm);
+	setup_routing_engines(osm, engine_names);
+	/* check if last routing engine exist in new list and update

callbacks */

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t · line 273

Quoted 5 lines
opensm/opensm/osm_opensm.c +5 -0
+	r = osm->routing_engine_list;
+	while (r) {
+		if (osm->routing_engine_used ==
+			osm_routing_engine_type(r->name)) {
+				update_routing_engine(r,

osm->last_routing_engine);

Quoted 9 lines

opensm/opensm/osm_opensm.c static void destroy_routing_engines(osm_opensm_t · line 282

Quoted 9 lines
opensm/opensm/osm_opensm.c +6 -0
+				free(osm->last_routing_engine);
+				osm->last_routing_engine = NULL;
+				break;
+		}
+	r = r->next;
+	}
 }
 
 

/**********************************************************************

Quoted 93 lines

opensm/opensm/osm_subnet.c static void opts_setup_sm_priority(osm_subn_t

Quoted 5 lines
opensm/opensm/osm_subnet.c +0 -0
index 8d63a75..742ae64 100644
@@ -152,6 +152,11 @@ static void opts_setup_sm_priority(osm_subn_t

*p_subn, void *p_val)

opensm/opensm/osm_subnet.c static void opts_setup_sm_priority(osm_subn_t · line 155

Quoted 4 lines
opensm/opensm/osm_subnet.c +1 -0
 	osm_set_sm_priority(p_sm, sm_priority);
 }
 
+static void opts_setup_routing_engine(osm_subn_t *p_subn, void

*p_val)

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 329

Quoted 9 lines
opensm/opensm/osm_subnet.c +4 -0
+{
+	osm_update_routing_engines(p_subn->p_osm, p_val);
+}
+
 static void opts_parse_net64(IN osm_subn_t *p_subn, IN char *p_key,
 			     IN char *p_val_str, void *p_v1, void *p_v2,
 			     void (*pfn)(osm_subn_t *, void *))
@@ -324,7 +329,7 @@ static const opt_rec_t opt_tbl[] = {
 	{ "hop_weights_file", OPT_OFFSET(hop_weights_file),

opts_parse_charp, NULL, 0 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 330

Quoted 1 line
opensm/opensm/osm_subnet.c +0 -0
 	{ "port_profile_switch_nodes",

OPT_OFFSET(port_profile_switch_nodes), opts_parse_boolean, NULL, 1 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 331

Quoted 1 line
opensm/opensm/osm_subnet.c +0 -0
 	{ "sweep_on_trap", OPT_OFFSET(sweep_on_trap),

opts_parse_boolean, NULL, 1 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 327

Quoted 1 line
opensm/opensm/osm_subnet.c +0 -1
-	{ "routing_engine", OPT_OFFSET(routing_engine_names),

opts_parse_charp, NULL, 0 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 332

Quoted 1 line
opensm/opensm/osm_subnet.c +1 -0
+	{ "routing_engine", OPT_OFFSET(routing_engine_names),

opts_parse_charp, opts_setup_routing_engine, 1 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 333

Quoted 1 line
opensm/opensm/osm_subnet.c +0 -0
 	{ "connect_roots", OPT_OFFSET(connect_roots),

opts_parse_boolean, NULL, 1 },

opensm/opensm/osm_subnet.c static const opt_rec_t opt_tbl[] = { · line 334

Quoted 1 line
opensm/opensm/osm_subnet.c +0 -0
 	{ "use_ucast_cache", OPT_OFFSET(use_ucast_cache),

opts_parse_boolean, NULL, 1 },

Review

Quoted 2 lines
opensm/opensm/osm_subnet.c +0 -0
 	{ "log_file", OPT_OFFSET(log_file), opts_parse_charp, NULL, 0 },
(quoted diff) +0 -0

b/opensm/opensm/osm_ucast_mgr.c

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t *

Quoted 4 lines

index 39d825c..d6294ac 100644

opensm/opensm/osm_ucast_mgr.c +0 -0
@@ -998,8 +998,23 @@ int osm_ucast_mgr_process(IN osm_ucast_mgr_t *

p_mgr)

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * · line 1003

Quoted 7 lines
opensm/opensm/osm_ucast_mgr.c +4 -0
 	p_osm->routing_engine_used = OSM_ROUTING_ENGINE_TYPE_NONE;
 	while (p_routing_eng) {
+		if (!p_routing_eng->initialized &&
+			p_routing_eng->setup(p_routing_eng, p_osm)) {
+			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+				"ERR 3A0F: setup of routing engine

\'%s\' failed\n",

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * · line 1005

Quoted 2 lines
opensm/opensm/osm_ucast_mgr.c +2 -0
+					p_routing_eng->name);
+					p_routing_eng =

p_routing_eng->next;

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * · line 1009

Quoted 4 lines
opensm/opensm/osm_ucast_mgr.c +4 -0
+					continue;
+		}
+		OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
+			"\'%s\' routing engine set up\n",

p_routing_eng->name);

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t *

Quoted 11 lines
opensm/opensm/osm_ucast_mgr.c +5 -0
+		p_routing_eng->initialized = 1;
 		if (!ucast_mgr_route(p_routing_eng, p_osm))
 			break;
+		/* delete unused routing engine */
+		if (p_routing_eng->delete)
+			p_routing_eng->delete(p_routing_eng->context);
+		p_routing_eng->initialized = 0;
 		p_routing_eng = p_routing_eng->next;
 	}
 
@@ -1011,6 +1026,19 @@ int osm_ucast_mgr_process(IN osm_ucast_mgr_t *

p_mgr)

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * · line 1026

Quoted 1 line
opensm/opensm/osm_ucast_mgr.c +0 -0
 		p_osm->routing_engine_used =

OSM_ROUTING_ENGINE_TYPE_MINHOP;

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * · line 1036

Quoted 10 lines
opensm/opensm/osm_ucast_mgr.c +8 -0
 	}
 
+	/* if for some reason different routing engine is used */
+	/* cleanup last unused routing engine */
+	p_routing_eng = p_osm->last_routing_engine;
+	if (p_routing_eng) {
+			if (p_routing_eng->initialized &&
+					p_routing_eng->delete &&
+					p_osm->routing_engine_used !=
+

osm_routing_engine_type(p_routing_eng->name))

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * · line 1037

Quoted 1 line
opensm/opensm/osm_ucast_mgr.c +1 -0
+

p_routing_eng->delete(p_routing_eng->context);

opensm/opensm/osm_ucast_mgr.c int osm_ucast_mgr_process(IN osm_ucast_mgr_t * · line 1044

Quoted 7 lines
opensm/opensm/osm_ucast_mgr.c +4 -0
+			free(p_routing_eng);
+			p_osm->last_routing_engine = NULL;
+	}
+
 	OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
 		"%s tables configured on all switches\n",
 

osm_routing_engine_type_str(p_osm->routing_engine_used));

Quoted 2 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma"

in

Quoted 3 lines

the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 8 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw
Quoted 39 lines · Eli Dorfman (Voltaire)
Quoted 31 lines · Slava Strebkov

HI!
That was my misunderstanding - upon heavy sweep SM will try to load routing engines as defined in the SM.conf file (ftree& updn - in that order).
So ftree will be loaded when switch comes back from reboot.

Slava

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Yevgeny Kliteynik
Sent: Monday, December 07, 2009 10:22 AM
To: Slava Strebkov
Cc: [email protected]
Subject: Re: [PATCH v3] opensm: support routing engine update

Slava,

Quoted 3 lines · Slava Strebkov

Hi Yevgeny,
In that case SM will use updn and will not come back to ftree automatically.

I think that this is a bad thing.

I wouldn't want *temporary* change of fabric to cause *permanent* change of SM mode of operation. Such changes do happen, and I'd prefer SM to continue functioning in accordance to the user's configuration once the fabric is settled again.

Quoted 6 lines

I do see the cases were the change that you propose is beneficial - if fabric topology doesn't fits the chosen routing, SM will waste time on retrying the wrong routing at every heavy sweep, but this happens due to suboptimal SM configuration and not as a result of some event that user has no control of.

Quoted 2 lines

For every heavy sweep the SM will try to configure the routing engines as specified in the conf file. So when a switch goes up and ftree configuration is valid, the SM will configure ftree instead of updn.

OK then, sounds good.

-- Yevgeny
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html