[openib-general] [PATCH] OpenSM/QoS: Better SLtoVLMappingTable determination

Hal Rosenstock halr at voltaire.com
Wed Jul 19 05:13:36 PDT 2006


OpenSM/QoS: Better SLtoVLMappingTable determination

On a switch, if VLCap 1 indicating 1 data VL, determine whether
SLtoVLMappingTable exists from port 0's capability mask. If more than 1
data VL, SLtoVLMappingTable must be supported. For HCA and router ports,
just check the capability mask.

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

Index: opensm/osm_qos.c
===================================================================
--- opensm/osm_qos.c	(revision 8586)
+++ opensm/osm_qos.c	(working copy)
@@ -197,27 +197,33 @@ static ib_api_status_t sl2vl_update_tabl
 			   cl_hton32(attr_mod), CL_DISP_MSGID_NONE, &context);
 }
 
-static ib_api_status_t sl2vl_update(osm_req_t * p_req,
+static ib_api_status_t sl2vl_update(osm_req_t * p_req, osm_port_t * p_port,
 				    osm_physp_t * p, unsigned port_num,
 				    const struct qos_config *qcfg)
 {
 	ib_api_status_t status;
 	unsigned i, num_ports;
-	ib_port_info_t *p_pi = osm_physp_get_port_info_ptr(p);
+	ib_port_info_t *p_pi;
+	osm_physp_t *p_physp;
 
 	if (!p_pi)
 		return IB_ERROR;
 
-	if (port_num == 0) {
+	if (osm_node_get_type(osm_physp_get_node_ptr(p)) == IB_NODE_TYPE_SWITCH) {
+		if (ib_port_info_get_vl_cap(p_pi) == 1) {
+			/* Check port 0's capability mask */
+			p_physp = osm_port_get_default_phys_ptr(p_port);
+			p_pi = osm_physp_get_port_info_ptr(p_physp);
+			if (!(p_pi->capability_mask & IB_PORT_CAP_HAS_SL_MAP))
+				return IB_SUCCESS;
+		}
+		num_ports = osm_node_get_num_physp(osm_physp_get_node_ptr(p));
+	} else {
+		p_pi = osm_physp_get_port_info_ptr(p); 
 		if (!(p_pi->capability_mask & IB_PORT_CAP_HAS_SL_MAP))
 			return IB_SUCCESS;
-	} else if (ib_port_info_get_vl_cap(p_pi) == 1)
-		return IB_SUCCESS;
-
-	if (osm_node_get_type(osm_physp_get_node_ptr(p)) == IB_NODE_TYPE_SWITCH)
-		num_ports = osm_node_get_num_physp(osm_physp_get_node_ptr(p));
-	else
 		num_ports = 1;
+	}
 
 	for (i = 0; i < num_ports; i++) {
 		status =
@@ -267,7 +273,8 @@ static ib_api_status_t vl_high_limit_upd
 }
 
 static ib_api_status_t qos_physp_setup(osm_log_t * p_log, osm_req_t * p_req,
-				       osm_physp_t * p, unsigned port_num,
+				       osm_port_t * p_port, osm_physp_t * p,
+				       unsigned port_num,
 				       const struct qos_config *qcfg)
 {
 	ib_api_status_t status;
@@ -297,7 +304,7 @@ static ib_api_status_t qos_physp_setup(o
 	}
 
 	/* setup SL2VL tables */
-	status = sl2vl_update(p_req, p, port_num, qcfg);
+	status = sl2vl_update(p_req, p_port, p, port_num, qcfg);
 	if (status != IB_SUCCESS) {
 		osm_log(p_log, OSM_LOG_ERROR,
 			"qos_physp_setup: ERR 6203 : "
@@ -356,7 +363,7 @@ osm_signal_t osm_qos_setup(osm_opensm_t 
 					continue;
 				status =
 				    qos_physp_setup(&p_osm->log, &p_osm->sm.req,
-						    p_physp, i, &swe_config);
+						    p_port, p_physp, i, &swe_config);
 			}
 			/* skip base port 0 */
 			p_sw = osm_get_switch_by_guid(&p_osm->subn,
@@ -377,7 +384,7 @@ osm_signal_t osm_qos_setup(osm_opensm_t 
 			continue;
 
 		status = qos_physp_setup(&p_osm->log, &p_osm->sm.req,
-					 p_physp, 0, cfg);
+					 p_port, p_physp, 0, cfg);
 	}
 
 	cl_plock_release(&p_osm->lock);







More information about the general mailing list