[ofa-general] [PATCH] opensm: Add ability to configure SMSL

Hal Rosenstock hnrose at comcast.net
Thu Jul 23 06:05:29 PDT 2009


Override default SM's SL to use in cases where LASH is not used.

Signed-off-by: Robert Pearson <rpearson at systemfabricworks.com>
Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com>
---

diff --git a/opensm/include/opensm/osm_subnet.h b/opensm/include/opensm/osm_subnet.h
index 29d3b73..6c20de8 100644
--- a/opensm/include/opensm/osm_subnet.h
+++ b/opensm/include/opensm/osm_subnet.h
@@ -224,6 +224,7 @@ typedef struct osm_subn_opt {
 	boolean_t consolidate_ipv6_snm_req;
 	struct osm_subn_opt *file_opts; /* used for update */
 	uint8_t lash_start_vl;			/* starting vl to use in lash */
+	uint8_t sm_sl;			/* which SL to use for SM/SA communication */
 } osm_subn_opt_t;
 /*
 * FIELDS
diff --git a/opensm/man/opensm.8.in b/opensm/man/opensm.8.in
index c71a79d..b23a973 100644
--- a/opensm/man/opensm.8.in
+++ b/opensm/man/opensm.8.in
@@ -12,6 +12,7 @@ opensm \- InfiniBand subnet manager and administration (SM/SA)
 [\-l(mc) <LMC>]
 [\-p(riority) <PRIORITY>]
 [\-smkey <SM_Key>]
+[\-\-sm_sl <SL number>]
 [\-r(eassign_lids)]
 [\-R <engine name(s)> | \-\-routing_engine <engine name(s)>]
 [\-\-do_mesh_analysis]
@@ -129,6 +130,10 @@ Note that OpenSM version 3.2.1 and below used the default value '1'
 in a host byte order, it is fixed now but you may need this option to
 interoperate with old OpenSM running on a little endian machine.
 .TP
+\fB\-\-sm_sl\fR <SL number>
+This option sets the SL to use for communication with the SM/SA.
+Defaults to 0.
+.TP
 \fB\-r\fR, \fB\-\-reassign_lids\fR
 This option causes OpenSM to reassign LIDs to all
 end nodes. Specifying -r on a running subnet
diff --git a/opensm/opensm/main.c b/opensm/opensm/main.c
index 62242f4..bf8e5c6 100644
--- a/opensm/opensm/main.c
+++ b/opensm/opensm/main.c
@@ -185,6 +185,8 @@ static void show_usage(void)
 	printf("--lash_start_vl <vl number>\n"
 		   "          Sets the starting VL to use for the lash routing algorithm.\n"
 		   "          Defaults to 0.\n");
+	printf("--sm_sl <sl number>\n"
+		   "          Sets the SL to use to communicate with the SM/SA. Defaults to 0.\n\n");
 	printf("--connect_roots, -z\n"
 	       "          This option enforces a routing engine (currently\n"
 	       "          up/down only) to make connectivity between root switches\n"
@@ -606,6 +608,7 @@ int main(int argc, char *argv[])
 		{"consolidate_ipv6_snm_req", 0, NULL, 4},
 		{"do_mesh_analysis", 0, NULL, 5},
 		{"lash_start_vl", 1, NULL, 6},
+		{"sm_sl", 1, NULL, 7},
 		{NULL, 0, NULL, 0}	/* Required at the end of the array */
 	};
 
@@ -966,6 +969,15 @@ int main(int argc, char *argv[])
 			opt.lash_start_vl = (uint8_t) temp;
 			printf(" LASH starting VL = %d\n", opt.lash_start_vl);
 			break;
+		case 7:
+			temp = strtol(optarg, NULL, 0);
+			if (temp < 0 || temp > 15) {
+				fprintf(stderr,
+					"ERROR: SM's SL must be between 0 and 15\n");
+				return (-1);
+			}
+			opt.sm_sl = (uint8_t) temp;
+			break;
 		case 'h':
 		case '?':
 		case ':':
diff --git a/opensm/opensm/osm_link_mgr.c b/opensm/opensm/osm_link_mgr.c
index 285096c..c9bdfee 100644
--- a/opensm/opensm/osm_link_mgr.c
+++ b/opensm/opensm/osm_link_mgr.c
@@ -71,7 +71,7 @@ static uint8_t link_mgr_get_smsl(IN osm_sm_t * sm, IN osm_physp_t * p_physp)
 	if (p_osm->routing_engine_used != OSM_ROUTING_ENGINE_TYPE_LASH) {
 		/* Use default SL if lash routing is not used */
 		OSM_LOG_EXIT(sm->p_log);
-		return (OSM_DEFAULT_SL);
+		return (sm->p_subn->opt.sm_sl);
 	}
 
 	/* Find osm_port of the SM itself = dest_port */
diff --git a/opensm/opensm/osm_subnet.c b/opensm/opensm/osm_subnet.c
index 3470b60..0d11811 100644
--- a/opensm/opensm/osm_subnet.c
+++ b/opensm/opensm/osm_subnet.c
@@ -391,6 +391,7 @@ static const opt_rec_t opt_tbl[] = {
 	{ "prefix_routes_file", OPT_OFFSET(prefix_routes_file), opts_parse_charp, NULL, 0 },
 	{ "consolidate_ipv6_snm_req", OPT_OFFSET(consolidate_ipv6_snm_req), opts_parse_boolean, NULL, 1 },
 	{ "lash_start_vl", OPT_OFFSET(lash_start_vl), opts_parse_uint8, NULL, 1 },
+	{ "sm_sl", OPT_OFFSET(sm_sl), opts_parse_uint8, NULL, 1 },
 	{0}
 };
 
@@ -760,6 +761,7 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * const p_opt)
 	p_opt->prefix_routes_file = strdup(OSM_DEFAULT_PREFIX_ROUTES_FILE);
 	p_opt->consolidate_ipv6_snm_req = FALSE;
 	p_opt->lash_start_vl = 0;
+	p_opt->sm_sl = OSM_DEFAULT_SL;
 	subn_init_qos_options(&p_opt->qos_options, NULL);
 	subn_init_qos_options(&p_opt->qos_ca_options, NULL);
 	subn_init_qos_options(&p_opt->qos_sw0_options, NULL);
@@ -1277,6 +1279,8 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t *const p_opts)
 		"# enhanced switch port 0. If TRUE, LMC value for subnet is used for\n"
 		"# ESP0. Otherwise, LMC value for ESP0s is 0.\n"
 		"lmc_esp0 %s\n\n"
+		"# sm_sl determines SMSL used for SM/SA communication\n"
+		"sm_sl %u\n\n"
 		"# The code of maximal time a packet can live in a switch\n"
 		"# The actual time is 4.096usec * 2^<packet_life_time>\n"
 		"# The value 0x14 disables this mechanism\n"
@@ -1326,6 +1330,7 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t *const p_opts)
 		cl_ntoh64(p_opts->subnet_prefix),
 		p_opts->lmc,
 		p_opts->lmc_esp0 ? "TRUE" : "FALSE",
+		p_opts->sm_sl,
 		p_opts->packet_life_time,
 		p_opts->vl_stall_count,
 		p_opts->leaf_vl_stall_count,



More information about the general mailing list