make file routing engine handle default/minhop conditions instead of
letting osm_ucast_mgr code handle the defaults.  This is so when file
routing returns a -1, it's because it's really failed.

Al

-- 
Albert Chu
[EMAIL PROTECTED]
925-422-5311
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
>From b445782d004da899efb20d19af2f2cc8cbdd89b3 Mon Sep 17 00:00:00 2001
From: Albert Chu <[EMAIL PROTECTED]>
Date: Fri, 12 Sep 2008 14:19:18 -0700
Subject: [PATCH] handle minhop lid_matrices and fwd_tables in file routing


Signed-off-by: Albert Chu <[EMAIL PROTECTED]>
---
 opensm/opensm/osm_ucast_file.c |   45 ++++++++++++++++++++++++---------------
 1 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/opensm/opensm/osm_ucast_file.c b/opensm/opensm/osm_ucast_file.c
index 3d00cb2..7a6bb91 100644
--- a/opensm/opensm/osm_ucast_file.c
+++ b/opensm/opensm/osm_ucast_file.c
@@ -50,6 +50,7 @@
 #include <complib/cl_debug.h>
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_switch.h>
+#include <opensm/osm_ucast_minhop.h>
 #include <opensm/osm_log.h>
 
 static uint16_t remap_lid(osm_opensm_t * p_osm, uint16_t lid, ib_net64_t guid)
@@ -118,6 +119,11 @@ static void add_lid_hops(osm_opensm_t * p_osm, osm_switch_t * p_sw,
 		osm_switch_set_hops(p_sw, lid, i, hops[i]);
 }
 
+static int do_minhop_ucast_file_load(osm_opensm_t *p_osm)
+{
+	return osm_ucast_minhop_build_fwd_tables(p_osm);
+}
+
 static int do_ucast_file_load(void *context)
 {
 	char line[1024];
@@ -134,16 +140,16 @@ static int do_ucast_file_load(void *context)
 	if (!file_name) {
 		OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,
 			"LFTs file name is not given; "
-			"using default routing algorithm\n");
-		return -1;
+			"using minhop routing algorithm\n");
+		return do_minhop_ucast_file_load(p_osm);
 	}
 
 	file = fopen(file_name, "r");
 	if (!file) {
 		OSM_LOG(&p_osm->log, OSM_LOG_ERROR | OSM_LOG_SYS, "ERR 6302: "
 			"cannot open ucast dump file \'%s\'; "
-			"using default routing algorithm\n", file_name);
-		return -1;
+			"using minhop routing algorithm\n", file_name);
+		return do_minhop_ucast_file_load(p_osm);
 	}
 
 	lineno = 0;
@@ -164,7 +170,7 @@ static int do_ucast_file_load(void *context)
 			OSM_LOG(&p_osm->log, OSM_LOG_ERROR | OSM_LOG_SYS,
 				"ERR 6303: "
 				"Multicast dump file detected; "
-				"skipping parsing. Using default "
+				"skipping parsing. Using minhop "
 				"routing algorithm\n");
 		} else if (!strncmp(p, "Unicast lids", 12)) {
 			if (p_sw)
@@ -176,7 +182,7 @@ static int do_ucast_file_load(void *context)
 					"PARSE ERROR: %s:%u: "
 					"cannot parse switch definition\n",
 					file_name, lineno);
-				return -1;
+				return do_minhop_ucast_file_load(p_osm);
 			}
 			p = q + 8;
 			sw_guid = strtoull(p, &q, 16);
@@ -185,7 +191,7 @@ static int do_ucast_file_load(void *context)
 					"PARSE ERROR: %s:%u: "
 					"cannot parse switch guid: \'%s\'\n",
 					file_name, lineno, p);
-				return -1;
+				return do_minhop_ucast_file_load(p_osm);
 			}
 			sw_guid = cl_hton64(sw_guid);
 
@@ -206,7 +212,7 @@ static int do_ucast_file_load(void *context)
 					"PARSE ERROR: %s:%u: "
 					"cannot parse lid: \'%s\'\n",
 					file_name, lineno, p);
-				return -1;
+				return do_minhop_ucast_file_load(p_osm);
 			}
 			p = q;
 			while (isspace(*p))
@@ -217,7 +223,7 @@ static int do_ucast_file_load(void *context)
 					"PARSE ERROR: %s:%u: "
 					"cannot parse port: \'%s\'\n",
 					file_name, lineno, p);
-				return -1;
+				return do_minhop_ucast_file_load(p_osm);
 			}
 			p = q;
 			/* additionally try to exract guid */
@@ -253,6 +259,11 @@ static int do_ucast_file_load(void *context)
 	return 0;
 }
 
+static int do_minhop_matrix_file_load(osm_opensm_t *p_osm)
+{
+	return osm_ucast_minhop_build_lid_matrices(p_osm);
+}
+
 static int do_lid_matrix_file_load(void *context)
 {
 	char line[1024];
@@ -269,17 +280,17 @@ static int do_lid_matrix_file_load(void *context)
 	if (!file_name) {
 		OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,
 			"lid matrix file name is not given; "
-			"using default lid matrix generation algorithm\n");
-		return -1;
+			"using minhop lid matrix generation algorithm\n");
+		return do_minhop_matrix_file_load(p_osm);
 	}
 
 	file = fopen(file_name, "r");
 	if (!file) {
 		OSM_LOG(&p_osm->log, OSM_LOG_ERROR | OSM_LOG_SYS, "ERR 6305: "
 			"cannot open lid matrix file \'%s\'; "
-			"using default lid matrix generation algorithm\n",
+			"using minhop lid matrix generation algorithm\n",
 			file_name);
-		return -1;
+		return do_minhop_matrix_file_load(p_osm);
 	}
 
 	lineno = 0;
@@ -303,7 +314,7 @@ static int do_lid_matrix_file_load(void *context)
 					"PARSE ERROR: %s:%u: "
 					"cannot parse switch definition\n",
 					file_name, lineno);
-				return -1;
+				return do_minhop_matrix_file_load(p_osm);
 			}
 			p = q + 8;
 			guid = strtoull(p, &q, 16);
@@ -312,7 +323,7 @@ static int do_lid_matrix_file_load(void *context)
 					"PARSE ERROR: %s:%u: "
 					"cannot parse switch guid: \'%s\'\n",
 					file_name, lineno, p);
-				return -1;
+				return do_minhop_matrix_file_load(p_osm);
 			}
 			guid = cl_hton64(guid);
 
@@ -337,7 +348,7 @@ static int do_lid_matrix_file_load(void *context)
 					"PARSE ERROR: %s:%u: "
 					"cannot parse lid: \'%s\'\n",
 					file_name, lineno, p);
-				return -1;
+				return do_minhop_matrix_file_load(p_osm);
 			}
 			/* Just checked the range, so casting is safe */
 			lid = (uint16_t) num;
@@ -351,7 +362,7 @@ static int do_lid_matrix_file_load(void *context)
 						"PARSE ERROR: %s:%u: "
 						"cannot parse hops number: \'%s\'\n",
 						file_name, lineno, p);
-					return -1;
+					return do_minhop_matrix_file_load(p_osm);
 				}
 				/* Just checked the range, so casting is safe */
 				hops[len++] = (uint8_t) num;
-- 
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