[ofa-general] ***SPAM*** Re: [PATCH v2] opensm: support routing engine update

Eli Dorfman (Voltaire) dorfman.eli at gmail.com
Tue Mar 17 03:16:18 PDT 2009


This patch fixes a bug in "support routing engine update" patch.
(Do you want a new patch that includes both?)

It fixes cleanup of last routing engine
Also use routing engine context instead of initialized flag.

Signed-off-by: Eli Dorfman <elid at voltaire.com>
---
 opensm/include/opensm/osm_opensm.h |    1 -
 opensm/opensm/osm_opensm.c         |    1 -
 opensm/opensm/osm_ucast_mgr.c      |    7 ++++---
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/opensm/include/opensm/osm_opensm.h b/opensm/include/opensm/osm_opensm.h
index d297dd8..401a73f 100644
--- a/opensm/include/opensm/osm_opensm.h
+++ b/opensm/include/opensm/osm_opensm.h
@@ -122,7 +122,6 @@ typedef enum _osm_routing_engine_type {
 struct osm_routing_engine {
 	const char *name;
 	void *context;
-	int initialized;
 	int (*setup) (void *re, void *p_osm);
 	int (*build_lid_matrices) (void *context);
 	int (*ucast_build_fwd_tables) (void *context);
diff --git a/opensm/opensm/osm_opensm.c b/opensm/opensm/osm_opensm.c
index 732f427..a9908e3 100644
--- a/opensm/opensm/osm_opensm.c
+++ b/opensm/opensm/osm_opensm.c
@@ -237,7 +237,6 @@ static void update_routing_engine(
 	struct osm_routing_engine *last)
 {
 	cur->context = last->context;
-	cur->initialized = last->initialized;
 	cur->setup = last->setup;
 	cur->build_lid_matrices = last->build_lid_matrices;
 	cur->ucast_build_fwd_tables = last->ucast_build_fwd_tables;
diff --git a/opensm/opensm/osm_ucast_mgr.c b/opensm/opensm/osm_ucast_mgr.c
index abae978..349c4bb 100644
--- a/opensm/opensm/osm_ucast_mgr.c
+++ b/opensm/opensm/osm_ucast_mgr.c
@@ -970,7 +970,7 @@ int osm_ucast_mgr_process(IN osm_ucast_mgr_t * const p_mgr)
 
 	p_osm->routing_engine_used = OSM_ROUTING_ENGINE_TYPE_NONE;
 	while (p_routing_eng) {
-		if (!p_routing_eng->initialized && 
+		if (!p_routing_eng->context && 
 			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", 
@@ -980,7 +980,6 @@ int osm_ucast_mgr_process(IN osm_ucast_mgr_t * const p_mgr)
 		}
 		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;
@@ -989,6 +988,7 @@ int osm_ucast_mgr_process(IN osm_ucast_mgr_t * const p_mgr)
 		if (p_routing_eng->delete)
 			p_routing_eng->delete(p_routing_eng->context);
 
+		p_routing_eng->context = NULL;
 		p_routing_eng = p_routing_eng->next;
 	}
 
@@ -1003,12 +1003,13 @@ int osm_ucast_mgr_process(IN osm_ucast_mgr_t * const p_mgr)
 	/* cleanup last unused routing engine */
 	p_routing_eng = p_osm->last_routing_engine;
 	if (p_routing_eng) {
-		if (p_routing_eng->initialized &&
+		if (p_routing_eng->context &&
 			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,
-- 
1.5.5




More information about the general mailing list