Hey Sasha,

As a follow up to patch 2/3, there were several locations in the code
where the determination of what routing algorithm was used to route the
subnet may not be done correctly.  Similar to patch 2/3, its due to the
possibility the routing algorithm fails, defaults back to 'minhop', but
the original routing engine variables are not modified to indicate an
alternate/default algorithm was used.

This patch tries to correct this by looking at the new 'routed_name'
field in struct osm_routing_engine instead of the other variables.

Thanks,
Al

-- 
Albert Chu
[EMAIL PROTECTED]
925-422-5311
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
>From 8352ddfbd25fc1f05cd41fbf3c366d4dfb010ac0 Mon Sep 17 00:00:00 2001
From: Albert L. Chu <[EMAIL PROTECTED]>
Date: Fri, 7 Dec 2007 13:44:38 -0800
Subject: [PATCH] fix incorrect identification of routing algorithm used


Signed-off-by: Albert L. Chu <[EMAIL PROTECTED]>
---
 opensm/opensm/osm_dump.c           |    9 ++++++---
 opensm/opensm/osm_sa_path_record.c |   15 ++++++++++-----
 opensm/opensm/osm_ucast_lash.c     |    8 +++++++-
 3 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/opensm/opensm/osm_dump.c b/opensm/opensm/osm_dump.c
index fa07f83..de333c5 100644
--- a/opensm/opensm/osm_dump.c
+++ b/opensm/opensm/osm_dump.c
@@ -49,6 +49,7 @@
 #include <iba/ib_types.h>
 #include <complib/cl_qmap.h>
 #include <complib/cl_debug.h>
+#include <complib/cl_passivelock.h>
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_node.h>
@@ -149,9 +150,11 @@ static void dump_ucast_routes(cl_map_item_t * p_map_item, void *cxt)
 		"Switch 0x%016" PRIx64 "\n"
 		"LID    : Port : Hops : Optimal\n",
 		cl_ntoh64(osm_node_get_node_guid(p_node)));
-
-	dor = (p_osm->routing_engine.name &&
-	       (strcmp(p_osm->routing_engine.name, "dor") == 0));
+	
+	cl_plock_acquire(&p_osm->routing_engine.routed_name_lock);
+	dor = (p_osm->routing_engine.routed_name &&
+	       (strcmp(p_osm->routing_engine.routed_name, "dor") == 0));
+	cl_plock_release(&p_osm->routing_engine.routed_name_lock);
 
 	for (lid_ho = 1; lid_ho <= max_lid_ho; lid_ho++) {
 		fprintf(file, "0x%04X : ", lid_ho);
diff --git a/opensm/opensm/osm_sa_path_record.c b/opensm/opensm/osm_sa_path_record.c
index f46a3be..992fc56 100644
--- a/opensm/opensm/osm_sa_path_record.c
+++ b/opensm/opensm/osm_sa_path_record.c
@@ -256,6 +256,8 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 	ib_slvl_table_t *p_slvl_tbl = NULL;
 	osm_qos_level_t *p_qos_level = NULL;
 	uint16_t valid_sl_mask = 0xffff;
+        struct osm_routing_engine *p_routing_eng;
+	int is_lash;
 
 	OSM_LOG_ENTER(p_rcv->p_log, __osm_pr_rcv_get_path_parms);
 
@@ -733,6 +735,12 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 	 * Set PathRecord SL.
 	 */
 
+        p_routing_eng = &p_rcv->p_subn->p_osm->routing_engine;
+	cl_plock_acquire(&p_routing_eng->routed_name_lock);
+        is_lash = (p_routing_eng->routed_name 
+                   && (strcmp(p_routing_eng->routed_name, "lash") == 0));
+	cl_plock_release(&p_routing_eng->routed_name_lock);
+
 	if (comp_mask & IB_PR_COMPMASK_SL) {
 		/*
 		 * Specific SL was requested
@@ -750,8 +758,7 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 			goto Exit;
 		}
 
-		if (p_rcv->p_subn->opt.routing_engine_name &&
-		    strcmp(p_rcv->p_subn->opt.routing_engine_name, "lash") == 0
+		if (is_lash
 		    && osm_get_lash_sl(p_rcv->p_subn->p_osm, p_src_port,
 				       p_dest_port) != sl) {
 			osm_log(p_rcv->p_log, OSM_LOG_ERROR,
@@ -762,9 +769,7 @@ __osm_pr_rcv_get_path_parms(IN osm_pr_rcv_t * const p_rcv,
 			goto Exit;
 		}
 
-	} else if (p_rcv->p_subn->opt.routing_engine_name &&
-		   strcmp(p_rcv->p_subn->opt.routing_engine_name,
-			  "lash") == 0) {
+	} else if (is_lash) {
 		/*
 		 * No specific SL in PathRecord request.
 		 * If it's LASH routing - use its SL.
diff --git a/opensm/opensm/osm_ucast_lash.c b/opensm/opensm/osm_ucast_lash.c
index bdcd2d1..b031cd3 100644
--- a/opensm/opensm/osm_ucast_lash.c
+++ b/opensm/opensm/osm_ucast_lash.c
@@ -53,6 +53,7 @@
 #include <errno.h>
 #include <complib/cl_debug.h>
 #include <complib/cl_qmap.h>
+#include <complib/cl_passivelock.h>
 #include <opensm/osm_switch.h>
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_log.h>
@@ -1488,8 +1489,13 @@ uint8_t osm_get_lash_sl(osm_opensm_t * p_osm, osm_port_t * p_src_port,
 	unsigned src_id;
 	osm_switch_t *p_sw;
 
-	if (p_osm->routing_engine.ucast_build_fwd_tables != lash_process)
+	cl_plock_acquire(&p_osm->routing_engine.routed_name_lock);
+	if (!p_osm->routing_engine.routed_name
+	    || (strcmp(p_osm->routing_engine.routed_name, "lash") != 0)) {
+		cl_plock_release(&p_osm->routing_engine.routed_name_lock);
 		return OSM_DEFAULT_SL;
+	}
+	cl_plock_release(&p_osm->routing_engine.routed_name_lock);	
 
 	p_sw = get_osm_switch_from_port(p_dst_port);
 	if (!p_sw)
-- 
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