always setup a routing engine, assume no default "fallthrough" minhop
routing engine.  On configured routing engine failure, do minhop as
a last resort.

Al

-- 
Albert Chu
[EMAIL PROTECTED]
925-422-5311
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
>From 84b63e74b1ee8305f1c6755707a03780df73cfbd Mon Sep 17 00:00:00 2001
From: Albert Chu <[EMAIL PROTECTED]>
Date: Fri, 12 Sep 2008 14:22:22 -0700
Subject: [PATCH] always setup a routing engine


Signed-off-by: Albert Chu <[EMAIL PROTECTED]>
---
 opensm/opensm/osm_opensm.c    |   25 +++++++++++++++----------
 opensm/opensm/osm_ucast_mgr.c |   29 ++++++++++++++---------------
 2 files changed, 29 insertions(+), 25 deletions(-)

diff --git a/opensm/opensm/osm_opensm.c b/opensm/opensm/osm_opensm.c
index 81a2f76..6b64fca 100644
--- a/opensm/opensm/osm_opensm.c
+++ b/opensm/opensm/osm_opensm.c
@@ -134,10 +134,15 @@ osm_routing_engine_type_t osm_routing_engine_type(IN const char *str)
 
 /**********************************************************************
  **********************************************************************/
-static int setup_routing_engine(osm_opensm_t * p_osm, const char *name)
+static void setup_routing_engine(osm_opensm_t * p_osm, const char *name)
 {
 	const struct routing_engine_module *r;
 
+	if (!name) {
+		osm_ucast_minhop_setup(p_osm);
+		return;
+	}
+
 	for (r = routing_modules; r->name && *r->name; r++) {
 		if (!strcmp(r->name, name)) {
 			p_osm->routing_engine.name = r->name;
@@ -145,15 +150,20 @@ static int setup_routing_engine(osm_opensm_t * p_osm, const char *name)
 				OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,
 					"setup of routing"
 					" engine \'%s\' failed\n", name);
-				return -2;
+				break;
 			}
 			OSM_LOG(&p_osm->log, OSM_LOG_DEBUG,
 				"\'%s\' routing engine set up\n",
 				p_osm->routing_engine.name);
-			return 0;
+			return;
 		}
 	}
-	return -1;
+
+	OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,
+		"cannot find or setup routing engine"
+		" \'%s\'. Minhop will be used instead\n",
+		name);
+	osm_ucast_minhop_setup(p_osm);
 }
 
 /**********************************************************************
@@ -371,12 +381,7 @@ osm_opensm_init(IN osm_opensm_t * const p_osm,
 		goto Exit;
 #endif				/* ENABLE_OSM_PERF_MGR */
 
-	if (p_opt->routing_engine_name &&
-	    setup_routing_engine(p_osm, p_opt->routing_engine_name))
-		OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,
-			"cannot find or setup routing engine"
-			" \'%s\'. Default will be used instead\n",
-			p_opt->routing_engine_name);
+	setup_routing_engine(p_osm, p_opt->routing_engine_name);
 
 	p_osm->routing_engine_used = OSM_ROUTING_ENGINE_TYPE_NONE;
 
diff --git a/opensm/opensm/osm_ucast_mgr.c b/opensm/opensm/osm_ucast_mgr.c
index d0259fb..bf04121 100644
--- a/opensm/opensm/osm_ucast_mgr.c
+++ b/opensm/opensm/osm_ucast_mgr.c
@@ -251,8 +251,8 @@ osm_signal_t osm_ucast_mgr_process(IN osm_ucast_mgr_t * const p_mgr)
 	struct osm_routing_engine *p_routing_eng;
 	osm_signal_t signal = OSM_SIGNAL_DONE;
 	cl_qmap_t *p_sw_guid_tbl;
-	int blm = 0;
-	int ubft = 0;
+	int blm = -1;
+	int ubft = -1;
 
 	OSM_LOG_ENTER(p_mgr->p_log);
 
@@ -271,28 +271,27 @@ osm_signal_t osm_ucast_mgr_process(IN osm_ucast_mgr_t * const p_mgr)
 
 	p_mgr->any_change = FALSE;
 
-	if (!p_routing_eng->build_lid_matrices ||
-	    (blm = p_routing_eng->build_lid_matrices(p_routing_eng->context)))
-		osm_ucast_minhop_build_lid_matrices(p_osm);
+	CL_ASSERT(p_routing_eng->build_lid_matrices);
+	CL_ASSERT(p_routing_eng->ucast_build_fwd_tables);
+
+	blm = p_routing_eng->build_lid_matrices(p_routing_eng->context);
 
 	/*
 	   Now that the lid matrices have been built, we can
 	   build and download the switch forwarding tables.
 	 */
-	if (!p_routing_eng->ucast_build_fwd_tables ||
-	    (ubft =
-	     p_routing_eng->ucast_build_fwd_tables(p_routing_eng->context)))
-		osm_ucast_minhop_build_fwd_tables(p_osm);
+	if (!blm)
+		ubft = p_routing_eng->ucast_build_fwd_tables(p_routing_eng->context);
 
-	/* 'file' routing engine has one unique logic corner case */
-	if (p_routing_eng->name && (strcmp(p_routing_eng->name, "file") == 0)
-	    && (!blm || !ubft))
-		p_osm->routing_engine_used = OSM_ROUTING_ENGINE_TYPE_FILE;
-	else if (!blm && !ubft)
+	if (!blm && !ubft)
 		p_osm->routing_engine_used =
 		    osm_routing_engine_type(p_routing_eng->name);
-	else
+	else {
+		/* If configured routing algorithm failed, use MinHop */
+		osm_ucast_minhop_build_lid_matrices(p_osm);
+		osm_ucast_minhop_build_fwd_tables(p_osm);
 		p_osm->routing_engine_used = OSM_ROUTING_ENGINE_TYPE_MINHOP;
+	}
 
 	OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
 		"%s tables configured on all switches\n",
-- 
1.5.4.5

_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to