[ofa-general] ***SPAM*** [PATCH] opensm: Add new partition keyword for all switches and hca.

Eli Dorfman (Voltaire) dorfman.eli at gmail.com
Thu Jan 1 07:40:40 PST 2009


 Add new partition keyword for all switches and hca.
 To allow firmware upgrade within managed switches we
 want all switch port 0 to have full membership.
 'ALL_SWITCH' means all switch end ports in the subnet
 'ALL_CA' means all CA end ports in the subnet.
 New default partition configuration will be:
 "Default=0x7fff,ipoib:ALL_CA, ALL_SWITCH=full, SELF=full;"

Signed-off-by: Eli Dorfman <elid at voltaire.com>
---
 opensm/opensm/osm_prtn.c        |   15 +++++++++------
 opensm/opensm/osm_prtn_config.c |   10 ++++++++--
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/opensm/opensm/osm_prtn.c b/opensm/opensm/osm_prtn.c
index be51410..8b9301e 100644
--- a/opensm/opensm/osm_prtn.c
+++ b/opensm/opensm/osm_prtn.c
@@ -135,7 +135,7 @@ ib_api_status_t osm_prtn_add_port(osm_log_t * p_log, osm_subn_t * p_subn,
 }
 
 ib_api_status_t osm_prtn_add_all(osm_log_t * p_log, osm_subn_t * p_subn,
-				 osm_prtn_t * p, boolean_t full)
+				 osm_prtn_t * p, uint8_t type, boolean_t full)
 {
 	cl_qmap_t *p_port_tbl = &p_subn->port_guid_tbl;
 	cl_map_item_t *p_item;
@@ -146,10 +146,13 @@ ib_api_status_t osm_prtn_add_all(osm_log_t * p_log, osm_subn_t * p_subn,
 	while (p_item != cl_qmap_end(p_port_tbl)) {
 		p_port = (osm_port_t *) p_item;
 		p_item = cl_qmap_next(p_item);
-		status = osm_prtn_add_port(p_log, p_subn, p,
-					   osm_port_get_guid(p_port), full);
-		if (status != IB_SUCCESS)
-			goto _err;
+		if (type == 0xff ||
+			(osm_node_get_type(p_port->p_node) == type)) {
+			status = osm_prtn_add_port(p_log, p_subn, p,
+						   osm_port_get_guid(p_port), full);
+			if (status != IB_SUCCESS)
+				goto _err;
+		}
 	}
 
 _err:
@@ -325,7 +328,7 @@ static ib_api_status_t osm_prtn_make_default(osm_log_t * const p_log,
 			      IB_DEFAULT_PARTIAL_PKEY);
 	if (!p)
 		goto _err;
-	status = osm_prtn_add_all(p_log, p_subn, p, no_config);
+	status = osm_prtn_add_all(p_log, p_subn, p, 0xff, no_config);
 	if (status != IB_SUCCESS)
 		goto _err;
 	cl_map_remove(&p->part_guid_tbl, p_subn->sm_port_guid);
diff --git a/opensm/opensm/osm_prtn_config.c b/opensm/opensm/osm_prtn_config.c
index 9511608..37f2bd6 100644
--- a/opensm/opensm/osm_prtn_config.c
+++ b/opensm/opensm/osm_prtn_config.c
@@ -64,7 +64,7 @@ extern osm_prtn_t *osm_prtn_make_new(osm_log_t * p_log, osm_subn_t * p_subn,
 				     const char *name, uint16_t pkey);
 extern ib_api_status_t osm_prtn_add_all(osm_log_t * p_log,
 					osm_subn_t * p_subn,
-					osm_prtn_t * p, boolean_t full);
+					osm_prtn_t * p, uint8_t type, boolean_t full);
 extern ib_api_status_t osm_prtn_add_port(osm_log_t * p_log,
 					 osm_subn_t * p_subn, osm_prtn_t * p,
 					 ib_net64_t guid, boolean_t full);
@@ -212,7 +212,13 @@ static int partition_add_port(unsigned lineno, struct part_conf *conf,
 
 	if (!strncmp(name, "ALL", strlen(name))) {
 		return osm_prtn_add_all(conf->p_log, conf->p_subn, p,
-					full) == IB_SUCCESS ? 0 : -1;
+					0xff, full) == IB_SUCCESS ? 0 : -1;
+	} else if (!strncmp(name, "ALL_SWITCH", strlen(name))) {
+		return osm_prtn_add_all(conf->p_log, conf->p_subn, p,
+					IB_NODE_TYPE_SWITCH, full) == IB_SUCCESS ? 0 : -1;
+	} else if (!strncmp(name, "ALL_CA", strlen(name))) {
+		return osm_prtn_add_all(conf->p_log, conf->p_subn, p,
+					IB_NODE_TYPE_CA, full) == IB_SUCCESS ? 0 : -1;
 	} else if (!strncmp(name, "SELF", strlen(name))) {
 		guid = cl_ntoh64(conf->p_subn->sm_port_guid);
 	} else {
-- 
1.5.5




More information about the general mailing list