implement routing chaining (parse multiple routing chainings, put them
into a list, add manpage entries, etc.)

Al

-- 
Albert Chu
[EMAIL PROTECTED]
925-422-5311
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
>From 672737b34fe5ecc696d4e52b6cf087b9d8256d98 Mon Sep 17 00:00:00 2001
From: Albert Chu <[EMAIL PROTECTED]>
Date: Fri, 12 Sep 2008 14:22:48 -0700
Subject: [PATCH] implement routing chaining


Signed-off-by: Albert Chu <[EMAIL PROTECTED]>
---
 opensm/include/opensm/osm_subnet.h |    7 +++----
 opensm/man/opensm.8.in             |    9 ++++++---
 opensm/opensm/main.c               |   11 +++++++----
 opensm/opensm/osm_opensm.c         |    9 ++++++++-
 opensm/opensm/osm_subnet.c         |   11 +++++++----
 5 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/opensm/include/opensm/osm_subnet.h b/opensm/include/opensm/osm_subnet.h
index f90f7ea..0c7f3b9 100644
--- a/opensm/include/opensm/osm_subnet.h
+++ b/opensm/include/opensm/osm_subnet.h
@@ -182,7 +182,7 @@ typedef struct osm_subn_opt {
 	char *port_prof_ignore_file;
 	boolean_t port_profile_switch_nodes;
 	boolean_t sweep_on_trap;
-	char *routing_engine_name;
+	char *routing_engine_names;
 	boolean_t connect_roots;
 	char *lid_matrix_dump_file;
 	char *lfts_file;
@@ -353,9 +353,8 @@ typedef struct osm_subn_opt {
 *	sweep_on_trap
 *		Received traps will initiate a new sweep.
 *
-*	routing_engine_name
-*		Name of used routing engine
-*		(other than default Min Hop Algorithm)
+*	routing_engine_names
+*		Name of routing engine(s) to use.
 *
 *	connect_roots
 *		The option which will enforce root to root connectivity with
diff --git a/opensm/man/opensm.8.in b/opensm/man/opensm.8.in
index 1a10f7b..51f572d 100644
--- a/opensm/man/opensm.8.in
+++ b/opensm/man/opensm.8.in
@@ -9,7 +9,7 @@ opensm \- InfiniBand subnet manager and administration (SM/SA)
 [\-F | \-\-config <file_name>] [\-c(reate-config) <file_name>]
 [\-g(uid)[=]<GUID in hex>] [\-l(mc) <LMC>]
 [\-p(riority) <PRIORITY>] [\-smkey <SM_Key>] [\-r(eassign_lids)]
-[\-R <engine name> | \-\-routing_engine <engine name>]
+[\-R <engine name(s)> | \-\-routing_engine <engine name>]
 [\-z | \-\-connect_roots]
 [\-M <file name> | \-\-lid_matrix_file <file name>]
 [\-U <file name> | \-\-lfts_file <file name>]
@@ -116,8 +116,11 @@ Without -r, OpenSM attempts to preserve existing
 LID assignments resolving multiple use of same LID.
 .TP
 \fB\-R\fR, \fB\-\-routing_engine\fR
-This option chooses routing engine instead of Min Hop
-algorithm (default).
+This option chooses routing engine(s) to use instead of Min Hop
+algorithm (default).  Multiple routing engines can be specified
+separated by commas so that specific ordering
+of routing algorithms will be tried if earlier routing
+engines fail.
 Supported engines: minhop, updn, file, ftree, lash, dor
 .TP
 \fB\-z\fR, \fB\-\-connect_roots\fR
diff --git a/opensm/opensm/main.c b/opensm/opensm/main.c
index 7db4ec9..7ff3af3 100644
--- a/opensm/opensm/main.c
+++ b/opensm/opensm/main.c
@@ -177,8 +177,11 @@ static void show_usage(void)
 	       "          LID assignments resolving multiple use of same LID.\n\n");
 	printf("-R\n"
 	       "--routing_engine <engine name>\n"
-	       "          This option chooses routing engine instead of Min Hop\n"
-	       "          algorithm (default).\n"
+	       "          This option chooses routing engine(s) to use instead of "
+	       "          Min Hop algorithm (default).  Multiple routing engines "
+	       "          can be specified separated by commas so that "
+	       "          specific ordering of routing algorithms will be tried if "
+	       "          earlier routing engines fail.\n"
 	       "          Supported engines: updn, file, ftree, lash, dor\n\n");
 	printf("-z\n"
 	       "--connect_roots\n"
@@ -851,8 +854,8 @@ int main(int argc, char *argv[])
 			break;
 
 		case 'R':
-			opt.routing_engine_name = optarg;
-			printf(" Activate \'%s\' routing engine\n", optarg);
+			opt.routing_engine_names = optarg;
+			printf(" Activate \'%s\' routing engine(s)\n", optarg);
 			break;
 
 		case 'z':
diff --git a/opensm/opensm/osm_opensm.c b/opensm/opensm/osm_opensm.c
index 5b49d0a..edce360 100644
--- a/opensm/opensm/osm_opensm.c
+++ b/opensm/opensm/osm_opensm.c
@@ -432,7 +432,14 @@ osm_opensm_init(IN osm_opensm_t * const p_osm,
 		goto Exit;
 #endif				/* ENABLE_OSM_PERF_MGR */
 
-	setup_routing_engine(p_osm, p_opt->routing_engine_name);
+	if (p_opt->routing_engine_names) {
+		char *p;
+		p = strtok(p_opt->routing_engine_names, ",");
+		while (p) {
+			setup_routing_engine(p_osm, p);
+			p = strtok(NULL, ",");
+		}
+	}
 
 	if (!p_osm->routing_engine_list)
 		setup_default_routing_engine(p_osm);
diff --git a/opensm/opensm/osm_subnet.c b/opensm/opensm/osm_subnet.c
index 278aa3d..a39ce75 100644
--- a/opensm/opensm/osm_subnet.c
+++ b/opensm/opensm/osm_subnet.c
@@ -442,7 +442,7 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * const p_opt)
 	p_opt->port_prof_ignore_file = NULL;
 	p_opt->port_profile_switch_nodes = FALSE;
 	p_opt->sweep_on_trap = TRUE;
-	p_opt->routing_engine_name = NULL;
+	p_opt->routing_engine_names = NULL;
 	p_opt->connect_roots = FALSE;
 	p_opt->lid_matrix_dump_file = NULL;
 	p_opt->lfts_file = NULL;
@@ -1264,7 +1264,7 @@ int osm_subn_parse_conf_file(char *file_name, osm_subn_opt_t * const p_opts)
 				    p_key, p_val, &p_opts->sweep_on_trap);
 
 		opts_unpack_charp("routing_engine",
-				  p_key, p_val, &p_opts->routing_engine_name);
+				  p_key, p_val, &p_opts->routing_engine_names);
 
 		opts_unpack_boolean("connect_roots",
 				    p_key, p_val, &p_opts->connect_roots);
@@ -1521,9 +1521,12 @@ int osm_subn_write_conf_file(char *file_name, IN osm_subn_opt_t *const p_opts)
 
 	fprintf(opts_file,
 		"# Routing engine\n"
+		"# Multiple routing engines can be specified separated by\n"
+		"# commas so that specific ordering of routing algorithms will\n"
+		"# be tried if earlier routing engines fail.\n"
 		"# Supported engines: minhop, updn, file, ftree, lash, dor\n"
-		"routing_engine %s\n\n", p_opts->routing_engine_name ?
-		p_opts->routing_engine_name : null_str);
+		"routing_engine %s\n\n", p_opts->routing_engine_names ?
+		p_opts->routing_engine_names : null_str);
 
 	fprintf(opts_file,
 		"# Connect roots (use FALSE if unsure)\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