remove minhop assumptions of when it might be running in updn mode by
having updn have an explicit callback for build_fwd_tables and specify
flags to indicate the behavior it wants from minhop.

Al
-- 
Albert Chu
[EMAIL PROTECTED]
925-422-5311
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
>From 0a63d625f66ee2d4458e31908b615b9466bb0d77 Mon Sep 17 00:00:00 2001
From: Albert Chu <[EMAIL PROTECTED]>
Date: Fri, 12 Sep 2008 14:22:05 -0700
Subject: [PATCH] remove minhop assumptions of being in updn mode


Signed-off-by: Albert Chu <[EMAIL PROTECTED]>
---
 opensm/include/opensm/osm_ucast_minhop.h |    5 ++++
 opensm/opensm/osm_ucast_dor.c            |    2 +-
 opensm/opensm/osm_ucast_minhop.c         |   33 +++++++++++------------------
 opensm/opensm/osm_ucast_updn.c           |   12 ++++++++++
 4 files changed, 31 insertions(+), 21 deletions(-)

diff --git a/opensm/include/opensm/osm_ucast_minhop.h b/opensm/include/opensm/osm_ucast_minhop.h
index 9ef5480..839a271 100644
--- a/opensm/include/opensm/osm_ucast_minhop.h
+++ b/opensm/include/opensm/osm_ucast_minhop.h
@@ -78,12 +78,17 @@ int osm_ucast_minhop_build_lid_matrices(IN osm_opensm_t * const p_osm);
 * SYNOPSIS
 */
 int osm_ucast_minhop_and_dor_build_fwd_tables(IN osm_opensm_t * const p_osm,
+					      IN boolean_t initialization_error_on_no_path,
 					      IN boolean_t dor);
 /*
 * PARAMETERS
 *	p_osm
 *		[in] Pointer to an osm_opensm_t object.
 *
+*	initialization_error_on_no_path
+*		[in] indicates if a subnet initialization error should be set
+*		if no path for routing is found.
+*
 *	dor
 *		[in] indicates dor routing
 *
diff --git a/opensm/opensm/osm_ucast_dor.c b/opensm/opensm/osm_ucast_dor.c
index 459cfef..dfa6d29 100644
--- a/opensm/opensm/osm_ucast_dor.c
+++ b/opensm/opensm/osm_ucast_dor.c
@@ -43,7 +43,7 @@
 
 int osm_ucast_dor_build_fwd_tables(osm_opensm_t * const p_osm)
 {
-        return osm_ucast_minhop_and_dor_build_fwd_tables(p_osm, TRUE);
+        return osm_ucast_minhop_and_dor_build_fwd_tables(p_osm, TRUE, TRUE);
 }
 
 int osm_ucast_dor_setup(osm_opensm_t * p_osm)
diff --git a/opensm/opensm/osm_ucast_minhop.c b/opensm/opensm/osm_ucast_minhop.c
index 54db855..1dcf615 100644
--- a/opensm/opensm/osm_ucast_minhop.c
+++ b/opensm/opensm/osm_ucast_minhop.c
@@ -67,6 +67,7 @@ struct osm_minhop_build_lid_matrices_data {
 struct osm_minhop_build_fwd_tables_data {
 	osm_opensm_t *p_osm;
 	cl_qlist_t port_order_list;
+	boolean_t initialization_error_on_no_path;
 	boolean_t dor;
 };
 
@@ -176,7 +177,7 @@ __osm_ucast_minhop_process_port(IN osm_opensm_t * const p_osm,
 				IN osm_switch_t * const p_sw,
 				IN osm_port_t * const p_port,
 				IN unsigned lid_offset,
-				IN boolean_t dor)
+				struct osm_minhop_build_fwd_tables_data *p_minhop_fwd_data)
 {
 	uint16_t min_lid_ho;
 	uint16_t max_lid_ho;
@@ -184,7 +185,6 @@ __osm_ucast_minhop_process_port(IN osm_opensm_t * const p_osm,
 	uint8_t port;
 	boolean_t is_ignored_by_port_prof;
 	ib_net64_t node_guid;
-	struct osm_routing_engine *p_routing_eng;
 	unsigned start_from = 1;
 
 	OSM_LOG_ENTER(&p_osm->log);
@@ -221,8 +221,6 @@ __osm_ucast_minhop_process_port(IN osm_opensm_t * const p_osm,
 
 	node_guid = osm_node_get_node_guid(p_sw->p_node);
 
-	p_routing_eng = &p_osm->routing_engine;
-
 	/*
 	   The lid matrix contains the number of hops to each
 	   lid from each port.  From this information we determine
@@ -231,24 +229,19 @@ __osm_ucast_minhop_process_port(IN osm_opensm_t * const p_osm,
 	 */
 	port = osm_switch_recommend_path(p_sw, p_port, lid_ho, start_from,
 					 p_osm->subn.ignore_existing_lfts,
-					 dor);
+					 p_minhop_fwd_data->dor);
 
 	if (port == OSM_NO_PATH) {
 		/* do not try to overwrite the ppro of non existing port ... */
 		is_ignored_by_port_prof = TRUE;
 
-		/* Up/Down routing can cause unreachable routes between some
-		   switches so we do not report that as an error in that case */
-		if (!p_routing_eng->build_lid_matrices) {
-			OSM_LOG(&p_osm->log, OSM_LOG_ERROR, "ERR 3A08: "
-				"No path to get to LID %u from switch 0x%"
-				PRIx64 "\n", lid_ho, cl_ntoh64(node_guid));
-			/* trigger a new sweep - try again ... */
+		OSM_LOG(&p_osm->log, OSM_LOG_ERROR, "ERR 3A08: "
+			"No path to get to LID %u from switch 0x%"
+			PRIx64 "\n", lid_ho, cl_ntoh64(node_guid));
+
+		/* trigger a new sweep - try again ... */
+		if (p_minhop_fwd_data->initialization_error_on_no_path)
 			p_osm->subn.subnet_initialization_error = TRUE;
-		} else
-			OSM_LOG(&p_osm->log, OSM_LOG_DEBUG,
-				"No path to get to LID %u from switch 0x%"
-				PRIx64 "\n", lid_ho, cl_ntoh64(node_guid));
 	} else {
 		osm_physp_t *p = osm_node_get_physp_ptr(p_sw->p_node, port);
 
@@ -343,11 +336,9 @@ __osm_ucast_minhop_process_tbl(IN cl_map_item_t * const p_map_item,
 	osm_opensm_t *p_osm;
 	osm_switch_t *const p_sw = (osm_switch_t *) p_map_item;
 	unsigned i, lids_per_port;
-	boolean_t dor;
 
 	p_minhop_fwd_data = context;
 	p_osm = p_minhop_fwd_data->p_osm;
-	dor = p_minhop_fwd_data->dor;	
 
 	OSM_LOG_ENTER(&p_osm->log);
 
@@ -380,7 +371,7 @@ __osm_ucast_minhop_process_tbl(IN cl_map_item_t * const p_map_item,
 							p_sw, 
 							port, 
 							i,
-							dor);
+							p_minhop_fwd_data);
 		}
 	}
 
@@ -611,6 +602,7 @@ static void clear_prof_ignore_flag(cl_map_item_t * const p_map_item, void *ctx)
 }
 
 int osm_ucast_minhop_and_dor_build_fwd_tables(osm_opensm_t * const p_osm,
+					      boolean_t initialization_error_on_no_path,
 					      boolean_t dor)
 {
 	struct osm_minhop_build_fwd_tables_data minhop_fwd_data;
@@ -620,6 +612,7 @@ int osm_ucast_minhop_and_dor_build_fwd_tables(osm_opensm_t * const p_osm,
 	       sizeof(struct osm_minhop_build_fwd_tables_data));
 	cl_qlist_init(&minhop_fwd_data.port_order_list);
 	minhop_fwd_data.p_osm = p_osm;
+	minhop_fwd_data.initialization_error_on_no_path = initialization_error_on_no_path;
 	minhop_fwd_data.dor = dor;
 
 	if (p_osm->subn.opt.guid_routing_order_file) {
@@ -661,7 +654,7 @@ int osm_ucast_minhop_and_dor_build_fwd_tables(osm_opensm_t * const p_osm,
 
 int osm_ucast_minhop_build_fwd_tables(osm_opensm_t * const p_osm)
 {
-	return osm_ucast_minhop_and_dor_build_fwd_tables(p_osm, FALSE);
+	return osm_ucast_minhop_and_dor_build_fwd_tables(p_osm, TRUE, FALSE);
 }
 
 int osm_ucast_minhop_setup(osm_opensm_t * p_osm)
diff --git a/opensm/opensm/osm_ucast_updn.c b/opensm/opensm/osm_ucast_updn.c
index 49799e3..5236427 100644
--- a/opensm/opensm/osm_ucast_updn.c
+++ b/opensm/opensm/osm_ucast_updn.c
@@ -670,6 +670,17 @@ static void __osm_updn_delete(void *context)
 	free(context);
 }
 
+static int osm_ucast_updn_build_fwd_tables(void *context)
+{
+	updn_t *p_updn = context;
+	/* Up/Down routing can cause unreachable routes between some
+	   switches so we do not want to report an initialization
+	   error when a path is not found. */
+	return osm_ucast_minhop_and_dor_build_fwd_tables(p_updn->p_osm,
+							 FALSE,
+							 FALSE);
+}
+
 int osm_ucast_updn_setup(osm_opensm_t * p_osm)
 {
 	updn_t *p_updn;
@@ -684,6 +695,7 @@ int osm_ucast_updn_setup(osm_opensm_t * p_osm)
 	p_osm->routing_engine.context = p_updn;
 	p_osm->routing_engine.delete = __osm_updn_delete;
 	p_osm->routing_engine.build_lid_matrices = __osm_updn_call;
+	p_osm->routing_engine.ucast_build_fwd_tables = osm_ucast_updn_build_fwd_tables;
 
 	return 0;
 }
-- 
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