Hey Sasha,

This patch 2/3 fixes the incorrect reporting of what routing engine was
used in the logs and in the console.  Based on which routing engine
succeeded in osm_ucast_mgr_process(), the result is stored in the
'routing_engine_used' and that result is used for the eventual output.
The lock in print_status() is across all p_osm data now and now uses
p_osm->lock.  The logic has been reverted in osm_ucast_mgr_process().

Some "special case" handling had to be done in osm_ucast_mgr_process()
to determine if a routing engine suceeded or failed.  It's not pretty.
I figure when routing engine chains are supported later on some re-org
in the routing engine code will have to be done, so this could be fixed
more properly at that time.

Thanks,
Al

-- 
Albert Chu
[EMAIL PROTECTED]
925-422-5311
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
>From 84571863cfe2ca2f427ee900b83c109afaca1897 Mon Sep 17 00:00:00 2001
From: Albert L. Chu <[EMAIL PROTECTED]>
Date: Tue, 18 Dec 2007 10:47:47 -0800
Subject: [PATCH] fix incorrect reporting of routing engine


Signed-off-by: Albert L. Chu <[EMAIL PROTECTED]>
---
 opensm/opensm/osm_console.c   |    6 +++-
 opensm/opensm/osm_ucast_mgr.c |   46 ++++++++++++++++++++++++++++++++---------
 2 files changed, 40 insertions(+), 12 deletions(-)

diff --git a/opensm/opensm/osm_console.c b/opensm/opensm/osm_console.c
index f669240..b277ab8 100644
--- a/opensm/opensm/osm_console.c
+++ b/opensm/opensm/osm_console.c
@@ -374,6 +374,7 @@ static char *sm_state_mgr_str(osm_sm_state_t state)
 static void print_status(osm_opensm_t * p_osm, FILE * out)
 {
 	if (out) {
+		cl_plock_acquire(&p_osm->lock);
 		fprintf(out, "   OpenSM Version     : %s\n", OSM_VERSION);
 		fprintf(out, "   SM State/Mgr State : %s/%s\n",
 			sm_state_str(p_osm->subn.sm_state),
@@ -381,8 +382,8 @@ static void print_status(osm_opensm_t * p_osm, FILE * out)
 		fprintf(out, "   SA State           : %s\n",
 			sa_state_str(p_osm->sa.state));
 		fprintf(out, "   Routing Engine     : %s\n",
-			p_osm->routing_engine.name ? p_osm->routing_engine.
-			name : "null (minhop)");
+			osm_routing_engine_type_str(p_osm->
+						    routing_engine_used));
 #ifdef ENABLE_OSM_PERF_MGR
 		fprintf(out, "\n   PerfMgr state/sweep state : %s/%s\n",
 			osm_perfmgr_get_state_str(&(p_osm->perfmgr)),
@@ -427,6 +428,7 @@ static void print_status(osm_opensm_t * p_osm, FILE * out)
 			p_osm->subn.first_time_master_sweep,
 			p_osm->subn.coming_out_of_standby);
 		fprintf(out, "\n");
+		cl_plock_release(&p_osm->lock);
 	}
 }
 
diff --git a/opensm/opensm/osm_ucast_mgr.c b/opensm/opensm/osm_ucast_mgr.c
index 8bb4739..e90d316 100644
--- a/opensm/opensm/osm_ucast_mgr.c
+++ b/opensm/opensm/osm_ucast_mgr.c
@@ -766,14 +766,18 @@ osm_ucast_mgr_read_guid_file(IN osm_ucast_mgr_t * const p_mgr,
  **********************************************************************/
 osm_signal_t osm_ucast_mgr_process(IN osm_ucast_mgr_t * const p_mgr)
 {
+	osm_opensm_t *p_osm;
 	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;
 
 	OSM_LOG_ENTER(p_mgr->p_log, osm_ucast_mgr_process);
 
 	p_sw_guid_tbl = &p_mgr->p_subn->sw_guid_tbl;
-	p_routing_eng = &p_mgr->p_subn->p_osm->routing_engine;
+	p_osm = p_mgr->p_subn->p_osm;
+	p_routing_eng = &p_osm->routing_engine;
 
 	p_mgr->is_dor = p_routing_eng->name
 	    && (strcmp(p_routing_eng->name, "dor") == 0);
@@ -789,23 +793,45 @@ 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 ||
-	    p_routing_eng->build_lid_matrices(p_routing_eng->context) != 0)
+	if (p_routing_eng->build_lid_matrices) {
+	    blm = p_routing_eng->build_lid_matrices(p_routing_eng->context);
+	    if (blm)
 		osm_ucast_mgr_build_lid_matrices(p_mgr);
-
-	osm_log(p_mgr->p_log, OSM_LOG_INFO,
-		"osm_ucast_mgr_process: "
-		"%s tables configured on all switches\n",
-		p_routing_eng->name ? p_routing_eng->name : "null (minhop)");
+	}
+	else
+	    osm_ucast_mgr_build_lid_matrices(p_mgr);
 
 	/*
 	   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 ||
-	    p_routing_eng->ucast_build_fwd_tables(p_routing_eng->context))
+	if (p_routing_eng->ucast_build_fwd_tables) {
+	    ubft = p_routing_eng->ucast_build_fwd_tables(p_routing_eng->context);
+	    if (ubft)
 		cl_qmap_apply_func(p_sw_guid_tbl, __osm_ucast_mgr_process_tbl,
 				   p_mgr);
+	}
+	else
+	    cl_qmap_apply_func(p_sw_guid_tbl, __osm_ucast_mgr_process_tbl,
+			       p_mgr);
+
+	/* '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)
+		p_osm->routing_engine_used = 
+			osm_routing_engine_type(p_routing_eng->name);
+	    else
+		p_osm->routing_engine_used = OSM_ROUTING_ENGINE_TYPE_MINHOP;
+	}
+
+	osm_log(p_mgr->p_log, OSM_LOG_INFO,
+		"osm_ucast_mgr_process: "
+		"%s tables configured on all switches\n",
+		osm_routing_engine_type_str(p_osm->routing_engine_used));
 
 	if (p_mgr->any_change) {
 		signal = OSM_SIGNAL_DONE_PENDING;
-- 
1.5.1

_______________________________________________
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