***SPAM*** Re: [ofa-general] [PATCH v2 1/2] opensm: Add new partition keyword for all hca, switches and routers

Eli Dorfman (Voltaire) dorfman.eli at gmail.com
Tue Jan 13 08:00:17 PST 2009


 Add new partition keyword for node type groups.
 The following new keywords were added:
 'ALL_CAS' means all CA end ports in the subnet.
 'ALL_SWITCHES' means all Switch end ports in the subnet
 'ALL_ROUTERS' means all Router end ports in the subnet
 For example, to allow firmware upgrade within managed switches we
 need that all switch port 0 to have full membership.

Signed-off-by: Eli Dorfman <elid at voltaire.com>
---
 opensm/opensm/osm_prtn.c        |   15 +++++++++------
 opensm/opensm/osm_prtn_config.c |   13 +++++++++++--
 2 files changed, 20 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..cb67377 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,16 @@ 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_CAS", 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, "ALL_SWITCHES", 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_ROUTERS", strlen(name))) {
+		return osm_prtn_add_all(conf->p_log, conf->p_subn, p,
+					IB_NODE_TYPE_ROUTER, 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