[openib-general] {PATCH] OpenSM: Support scope for IPoIB multicast groups in partition config

Hal Rosenstock halr at voltaire.com
Fri Jan 5 13:15:35 PST 2007


OpenSM: Support scope for IPoIB multicast groups in partition config

Signed-off-by: Hal Rosenstock <halr at voltaire.com>

diff --git a/osm/doc/partition-config.txt b/osm/doc/partition-config.txt
index 2306d4c..0841c53 100644
--- a/osm/doc/partition-config.txt
+++ b/osm/doc/partition-config.txt
@@ -42,14 +42,16 @@ flag          - used to indicate IPoIB c
 
 Currently recognized flags are:
 
-ipoib      - indicates that this partition may be used for IPoIB, as
-             result IPoIB capable MC group will be created.
-rate=<val> - specifies rate for this IPoIB MC group (default is 3 (10GBps))
-mtu=<val>  - specifies MTU for this IPoIB MC group (default is 4 (2048))
-sl=<val>   - specifies SL for this IPoIB MC group (default is 0)
-
-Note that values for 'rate' and 'mtu' should be specified as defined in
-IBTA specification (for example mtu=4 for 2048).
+ipoib       - indicates that this partition may be used for IPoIB, as
+              result IPoIB capable MC group will be created.
+rate=<val>  - specifies rate for this IPoIB MC group (default is 3 (10GBps))
+mtu=<val>   - specifies MTU for this IPoIB MC group (default is 4 (2048))
+sl=<val>    - specifies SL for this IPoIB MC group (default is 0)
+scope=<val> - specifies scope for this IPoIB MC group (default is 2 (link
+local))
+
+Note that values for 'rate', 'mtu'. and 'scope' should be specified as defined
+in the IBTA specification (for example mtu=4 for 2048).
 
 
 PortGUIDs list:
diff --git a/osm/man/opensm.8 b/osm/man/opensm.8
index 973b3f1..8ea7b91 100644
--- a/osm/man/opensm.8
+++ b/osm/man/opensm.8
@@ -1,4 +1,4 @@
-.TH OPENSM 8 "January 2, 2007" "OpenIB" "OpenIB Management"
+.TH OPENSM 8 "January 5, 2007" "OpenIB" "OpenIB Management"
 
 .SH NAME
 opensm \- InfiniBand subnet manager and administration (SM/SA) 
@@ -286,17 +286,19 @@ Partition Definition:
 
 Currently recognized flags are:
 
- ipoib      - indicates that this partition may be used for IPoIB, as
-              result IPoIB capable MC group will be created.
- rate=<val> - specifies rate for this IPoIB MC group
-              (default is 3 (10GBps))
- mtu=<val>  - specifies MTU for this IPoIB MC group
-              (default is 4 (2048))
- sl=<val>   - specifies SL for this IPoIB MC group
-              (default is 0)
-
-Note that values for 'rate' and 'mtu' should be specified as defined in
-IBTA specification (for example, mtu=4 for 2048).
+ ipoib       - indicates that this partition may be used for IPoIB, as
+               result IPoIB capable MC group will be created.
+ rate=<val>  - specifies rate for this IPoIB MC group
+               (default is 3 (10GBps))
+ mtu=<val>   - specifies MTU for this IPoIB MC group
+               (default is 4 (2048))
+ sl=<val>    - specifies SL for this IPoIB MC group
+               (default is 0)
+ scope=<val> - specifies scope for this IPoIB MC group
+               (default is 2 (link local))
+
+Note that values for rate, mtu, and scope should be specified as
+defined in the IBTA specification (for example, mtu=4 for 2048).
 
 PortGUIDs list:
 
diff --git a/osm/opensm/osm_prtn.c b/osm/opensm/osm_prtn.c
index 1a4fc52..43c242b 100644
--- a/osm/opensm/osm_prtn.c
+++ b/osm/opensm/osm_prtn.c
@@ -165,7 +165,7 @@ ib_api_status_t osm_prtn_add_all(osm_log
 	return status;
 }
 
-static const ib_gid_t osm_ipoib_mgid = {
+static ib_gid_t osm_ipoib_mgid = {
   {
     0xff,                           /*  multicast field */
     0x12,                           /*  non-permanent bit, link local scope */
@@ -193,7 +193,8 @@ static const ib_gid_t osm_ts_ipoib_mgid
 
 ib_api_status_t osm_prtn_add_mcgroup(osm_log_t *p_log,
 				     osm_subn_t *p_subn, osm_prtn_t *p,
-				     unsigned is_ipoib, uint8_t rate, uint8_t mtu)
+				     unsigned is_ipoib, uint8_t rate,
+				     uint8_t mtu, uint8_t scope)
 {
 	ib_member_rec_t mc_rec;
 	ib_net64_t comp_mask;
@@ -201,7 +202,7 @@ ib_api_status_t osm_prtn_add_mcgroup(osm
 	osm_mgrp_t *p_mgrp = NULL;
 	osm_sa_t *p_sa = &p_subn->p_osm->sa;
 	ib_api_status_t status = IB_SUCCESS;
-	uint8_t scope;
+	uint8_t ts_scope;
 
 	pkey = p->pkey | cl_hton16(0x8000);
 
@@ -218,12 +219,13 @@ ib_api_status_t osm_prtn_add_mcgroup(osm
 	mc_rec.pkt_life = OSM_DEFAULT_SUBNET_TIMEOUT;
 	mc_rec.sl_flow_hop = ib_member_set_sl_flow_hop(p->sl, 0, 0);
 	/* Scope in MCMemberRecord needs to be consistent with MGID */
-	scope = ib_mgid_get_scope(&osm_ipoib_mgid); /* get scope from MGID */
-	mc_rec.scope_state = ib_member_set_scope_state(scope, MC_FULL_MEMBER);
+	mc_rec.scope_state = ib_member_set_scope_state(scope ? scope : OSM_DEFAULT_MGRP_SCOPE, MC_FULL_MEMBER);
+	ib_mgid_set_scope(&mc_rec.mgid, scope ? scope : OSM_DEFAULT_MGRP_SCOPE);
 
-	/* don't update rate, mtu */
+	/* don't update rate, mtu, scope */
 	comp_mask = IB_MCR_COMPMASK_MTU | IB_MCR_COMPMASK_MTU_SEL
-			| IB_MCR_COMPMASK_RATE | IB_MCR_COMPMASK_RATE_SEL;
+			| IB_MCR_COMPMASK_RATE | IB_MCR_COMPMASK_RATE_SEL
+			| IB_MCR_COMPMASK_SCOPE;
 	status = osm_mcmr_rcv_find_or_create_new_mgrp(&p_sa->mcmr_rcv,
 						      comp_mask, &mc_rec, &p_mgrp);
 	if (!p_mgrp || status != IB_SUCCESS)
@@ -238,6 +240,9 @@ ib_api_status_t osm_prtn_add_mcgroup(osm
 	/* FIXME: remove this upon TS fixes */
 	mc_rec.mgid = osm_ts_ipoib_mgid;
 	memcpy(&mc_rec.mgid.raw[4], &pkey, sizeof(pkey));
+	/* Scope in MCMemberRecord needs to be consistent with MGID */
+	ts_scope = ib_mgid_get_scope(&osm_ts_ipoib_mgid); /* get scope from MGID */
+	mc_rec.scope_state = ib_member_set_scope_state(ts_scope, MC_FULL_MEMBER);
 	status = osm_mcmr_rcv_find_or_create_new_mgrp(&p_sa->mcmr_rcv,
 			comp_mask, &mc_rec, &p_mgrp);
 	if (p_mgrp)
@@ -331,7 +336,7 @@ static ib_api_status_t osm_prtn_make_def
 	status = osm_prtn_add_port(p_log, p_subn, p, p_subn->sm_port_guid, TRUE);
 
 	if (no_config)
-		osm_prtn_add_mcgroup(p_log, p_subn, p, 1, 0, 0);
+		osm_prtn_add_mcgroup(p_log, p_subn, p, 1, 0, 0, 0);
 
   _err:
 	return status;
diff --git a/osm/opensm/osm_prtn_config.c b/osm/opensm/osm_prtn_config.c
index b9a88c3..dbce497 100644
--- a/osm/opensm/osm_prtn_config.c
+++ b/osm/opensm/osm_prtn_config.c
@@ -69,7 +69,7 @@ struct part_conf {
 	osm_log_t  *p_log;
 	osm_subn_t *p_subn;
 	osm_prtn_t *p_prtn;
-	unsigned    is_ipoib, mtu, rate, sl;
+	unsigned    is_ipoib, mtu, rate, sl, scope;
 };
 
 extern osm_prtn_t *osm_prtn_make_new(osm_log_t *p_log, osm_subn_t *p_subn,
@@ -83,7 +83,7 @@ extern ib_api_status_t osm_prtn_add_port
 extern ib_api_status_t osm_prtn_add_mcgroup(osm_log_t *p_log,
 					    osm_subn_t *p_subn, osm_prtn_t *p,
 					    unsigned is_ipoib, uint8_t rate,
-					    uint8_t mtu);
+					    uint8_t mtu, uint8_t scope);
 
 static int partition_create(unsigned lineno, struct part_conf *conf,
 			    char *name, char *id, char *flag, char *flag_val)
@@ -122,7 +122,7 @@ static int partition_create(unsigned lin
 	if (conf->is_ipoib)
 		osm_prtn_add_mcgroup(conf->p_log, conf->p_subn, conf->p_prtn,
 			     conf->is_ipoib, (uint8_t)conf->rate,
-			     (uint8_t)conf->mtu);
+			     (uint8_t)conf->mtu, (uint8_t)conf->scope);
 
 	return 0;
 }
@@ -145,6 +145,12 @@ static int partition_add_flag(unsigned l
 				"PARSE WARN: line %d: "
 				"flag \'rate\' requires valid value"
 				" - skipped\n", lineno);
+	} else if (!strncmp(flag, "scope", len)) {
+		if (!val || (conf->scope = strtoul(val, NULL, 0)) == 0)
+			osm_log(conf->p_log, OSM_LOG_VERBOSE,
+				"PARSE WARN: line %d: "
+				"flag \'scope\' requires valid value"
+				" - skipped\n", lineno);
 	} else if (!strncmp(flag, "sl", len)) {
 		unsigned sl;
 		char *end;
@@ -206,7 +212,6 @@ static int partition_add_port(unsigned l
 	return 0;
 }
 
-
 /* conf file parser */
 
 #define STRIP_HEAD_SPACES(p) while (*(p) == ' ' || *(p) == '\t' || \







More information about the general mailing list