[ofa-general] [PATCH 2/4] opensm: adding ucast cache option

Yevgeny Kliteynik kliteyn at dev.mellanox.co.il
Sun May 4 03:00:36 PDT 2008


Adding ucast cache option to OpenSM command line
arguments: -F or --ucast_cache.

Signed-off-by:  Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>
---
 opensm/include/opensm/osm_subnet.h |    6 +++++-
 opensm/opensm/main.c               |   33 +++++++++++++++++++++++++++++++--
 opensm/opensm/osm_subnet.c         |   11 ++++++++++-
 3 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/opensm/include/opensm/osm_subnet.h b/opensm/include/opensm/osm_subnet.h
index b1dd659..cffbe5e 100644
--- a/opensm/include/opensm/osm_subnet.h
+++ b/opensm/include/opensm/osm_subnet.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -256,6 +256,7 @@ typedef struct _osm_subn_opt {
 	boolean_t sweep_on_trap;
 	char *routing_engine_name;
 	boolean_t connect_roots;
+	boolean_t use_ucast_cache;
 	char *lid_matrix_dump_file;
 	char *ucast_dump_file;
 	char *root_guid_file;
@@ -441,6 +442,9 @@ typedef struct _osm_subn_opt {
 *		up/down routing engine (even if this violates "pure" deadlock
 *		free up/down algorithm)
 *
+*	use_ucast_cache
+*		When TRUE enables unicast routing cache.
+*
 *	lid_matrix_dump_file
 *		Name of the lid matrix dump file from where switch
 *		lid matrices (min hops tables) will be loaded
diff --git a/opensm/opensm/main.c b/opensm/opensm/main.c
index fb41d50..71deacb 100644
--- a/opensm/opensm/main.c
+++ b/opensm/opensm/main.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -183,6 +183,17 @@ static void show_usage(void)
 	       "          and in this way be IBA compliant. In many cases,\n"
 	       "          this can violate \"pure\" deadlock free algorithm, so\n"
 	       "          use it carefully.\n\n");
+	printf("-F\n"
+	       "--ucast_cache\n"
+	       "          This option enables unicast routing cache to prevent\n"
+	       "          routing recalculation (which is a heavy task in a\n"
+	       "          large cluster) when there was no topology change\n"
+	       "          detected during the heavy sweep, or when the topology\n"
+	       "          change does not require new routing calculation,\n"
+	       "          e.g. in case of host reboot.\n"
+	       "          This option becomes very handy when the cluster size\n"
+	       "          is thousands of nodes.\n"
+	       "          Unicast cache is not supported for LMC > 0.\n\n");
 	printf("-M\n"
 	       "--lid_matrix_file <file name>\n"
 	       "          This option specifies the name of the lid matrix dump file\n"
@@ -599,7 +610,7 @@ int main(int argc, char *argv[])
 	char *ignore_guids_file_name = NULL;
 	uint32_t val;
 	const char *const short_option =
-	    "i:f:ed:g:l:L:s:t:a:u:m:R:zM:U:S:P:Y:NBIQvVhorcyxp:n:q:k:C:";
+	    "i:f:ed:g:l:L:s:t:a:u:m:R:zM:U:S:P:Y:FNBIQvVhorcyxp:n:q:k:C:";

 	/*
 	   In the array below, the 2nd parameter specifies the number
@@ -634,6 +645,7 @@ int main(int argc, char *argv[])
 		{"smkey", 1, NULL, 'k'},
 		{"routing_engine", 1, NULL, 'R'},
 		{"connect_roots", 0, NULL, 'z'},
+		{"ucast_cache", 0, NULL, 'F'},
 		{"lid_matrix_file", 1, NULL, 'M'},
 		{"ucast_file", 1, NULL, 'U'},
 		{"sadb_file", 1, NULL, 'S'},
@@ -805,6 +817,12 @@ int main(int argc, char *argv[])
 					"ERROR: LMC must be 7 or less.");
 				return (-1);
 			}
+			if (opt.use_ucast_cache && temp > 0) {
+				fprintf(stderr,
+					"ERROR: Unicast routing cache is "
+					"not supported for LMC > 0\n");
+				return (-1);
+			}
 			opt.lmc = (uint8_t) temp;
 			printf(" LMC = %d\n", temp);
 			break;
@@ -891,6 +909,17 @@ int main(int argc, char *argv[])
 			printf(" Connect roots option is on\n");
 			break;

+		case 'F':
+			if (opt.lmc > 0) {
+				fprintf(stderr,
+					"ERROR: Unicast routing cache is "
+					"not supported for LMC > 0\n");
+				return (-1);
+			}
+			opt.use_ucast_cache = TRUE;
+			printf(" Unicast routing cache option is on\n");
+			break;
+
 		case 'M':
 			opt.lid_matrix_dump_file = optarg;
 			printf(" Lid matrix dump file is \'%s\'\n", optarg);
diff --git a/opensm/opensm/osm_subnet.c b/opensm/opensm/osm_subnet.c
index 47d735f..dc55e72 100644
--- a/opensm/opensm/osm_subnet.c
+++ b/opensm/opensm/osm_subnet.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -461,6 +461,7 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * const p_opt)
 	p_opt->sweep_on_trap = TRUE;
 	p_opt->routing_engine_name = NULL;
 	p_opt->connect_roots = FALSE;
+	p_opt->use_ucast_cache = FALSE;
 	p_opt->lid_matrix_dump_file = NULL;
 	p_opt->ucast_dump_file = NULL;
 	p_opt->root_guid_file = NULL;
@@ -1290,6 +1291,9 @@ ib_api_status_t osm_subn_parse_conf_file(IN osm_subn_opt_t * const p_opts)
 		opts_unpack_boolean("connect_roots",
 				    p_key, p_val, &p_opts->connect_roots);

+		opts_unpack_boolean("use_ucast_cache",
+				    p_key, p_val, &p_opts->use_ucast_cache);
+
 		opts_unpack_charp("log_file", p_key, p_val, &p_opts->log_file);

 		opts_unpack_uint32("log_max_size",
@@ -1543,6 +1547,11 @@ ib_api_status_t osm_subn_write_conf_file(IN osm_subn_opt_t * const p_opts)
 			"# Connect roots (use FALSE if unsure)\n"
 			"connect_roots %s\n\n",
 			p_opts->connect_roots ? "TRUE" : "FALSE");
+	if (p_opts->use_ucast_cache)
+		fprintf(opts_file,
+			"# Use unicast routing cache (use FALSE if unsure)\n"
+			"use_ucast_cache %s\n\n",
+			p_opts->use_ucast_cache ? "TRUE" : "FALSE");
 	if (p_opts->lid_matrix_dump_file)
 		fprintf(opts_file,
 			"# Lid matrix dump file name\n"
-- 
1.5.1.4




More information about the general mailing list