diff mbox

[PATCHv3] opensm: Add support for optimized SLtoVLMappingTable programming

Message ID 20091229162912.GY26940@me (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Sasha Khapyorsky Dec. 29, 2009, 4:29 p.m. UTC
None
diff mbox

Patch

diff --git a/opensm/opensm/osm_slvl_map_rcv.c b/opensm/opensm/osm_slvl_map_rcv.c
index 7ca0b8f..73c6253 100644
--- a/opensm/opensm/osm_slvl_map_rcv.c
+++ b/opensm/opensm/osm_slvl_map_rcv.c
@@ -72,8 +72,8 @@  void osm_slvl_rcv_process(IN void *context, IN void *p_data)
 	ib_net64_t port_guid;
 	ib_net64_t node_guid;
 	uint32_t attr_mod;
-	uint8_t out_port_num, in_port_num, startinport, startoutport,
-		endinport, endoutport;
+	uint8_t startinport, endinport, startoutport, endoutport;
+	uint8_t in_port, out_port;
 
 	CL_ASSERT(sm);
 
@@ -109,80 +109,51 @@  void osm_slvl_rcv_process(IN void *context, IN void *p_data)
 	if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH) {
 		unsigned num_ports = osm_node_get_num_physp(p_node) - 1;
 		attr_mod = cl_ntoh32(p_smp->attr_mod);
-		out_port_num = attr_mod & 0xff;
-		in_port_num = (attr_mod >> 8) & 0xff;
-		if (in_port_num > num_ports || out_port_num > num_ports) {
+
+		if (attr_mod & 0x10000) {
+			startoutport = ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info) ? 0 : 1;
+			endoutport = osm_node_get_num_physp(p_node) - 1;
+		} else
+			startoutport = endoutport = attr_mod & 0xff;
+
+		if (attr_mod & 0x20000) {
+			startinport = ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info) ? 0 : 1;
+			endinport = osm_node_get_num_physp(p_node) - 1;
+		} else
+			startinport = endinport = (attr_mod >> 8) & 0xff;
+
+		if (startinport > num_ports || startoutport > num_ports) {
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2C07"
 				"Invalid attribute modifier 0x%x reveived in"
 				" response from switch 0x%" PRIx64 "\n",
-				cl_ntoh32(p_smp->attr_mod),
-				cl_ntoh64(node_guid));
+				cl_ntoh32(attr_mod), cl_ntoh64(node_guid));
 			goto Exit;
 		}
-		if (attr_mod & 0x30000)
-			goto opt_sl2vl;
-		p_physp = osm_node_get_physp_ptr(p_node, out_port_num);
-	} else {
-		p_physp = p_port->p_physp;
-		out_port_num = p_physp->port_num;
-		in_port_num = 0;
-	}
 
-	/*
-	   We do not care if this is a result of a set or get -
-	   all we want is to update the subnet.
-	 */
-	OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
-		"Received SLtoVL GetResp in_port_num %u out_port_num %u with "
-		"GUID 0x%" PRIx64 " for parent node GUID 0x%" PRIx64 ", TID 0x%"
-		PRIx64 "\n", in_port_num, out_port_num, cl_ntoh64(port_guid),
-		cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id));
-
-	/*
-	   Determine if we encountered a new Physical Port.
-	   If so, Ignore it.
-	 */
-	if (!p_physp) {
-		OSM_LOG(sm->p_log, OSM_LOG_ERROR,
-			"Got invalid port number %u\n", out_port_num);
-		goto Exit;
+	} else {
+		startoutport = endoutport = p_port->p_physp->port_num;
+		startinport = endinport = 0;
 	}
 
-	osm_dump_slvl_map_table(sm->p_log, port_guid, in_port_num,
-				out_port_num, p_slvl_tbl, OSM_LOG_DEBUG);
-
-	osm_physp_set_slvl_tbl(p_physp, p_slvl_tbl, in_port_num);
-	goto Exit;
-
-opt_sl2vl:
-	if (osm_log_is_active(sm->p_log, OSM_LOG_VERBOSE))
-		osm_log(sm->p_log, OSM_LOG_VERBOSE,
-			"Received optimized SLtoVL get response in_port_num %u "
-			"out_port_num %u with GUID 0x%" PRIx64 " for parent "
-			"node GUID 0x%" PRIx64 ", TID 0x%" PRIx64 "\n",
-			in_port_num, out_port_num, cl_ntoh64(port_guid),
-			cl_ntoh64(node_guid), cl_ntoh64(p_smp->trans_id));
-
-	osm_dump_slvl_map_table(sm->p_log, port_guid, in_port_num,
-				out_port_num, p_slvl_tbl, OSM_LOG_DEBUG);
-
-	if (attr_mod & 0x10000) {
-		startoutport = ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info) ? 0 : 1;
-		endoutport = osm_node_get_num_physp(p_node);
-	} else
-		endoutport = startoutport = out_port_num;
-	if (attr_mod & 0x20000) {
-		startinport = ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info) ? 0 : 1;
-		endinport = osm_node_get_num_physp(p_node);
-	} else
-		endinport = startinport = in_port_num;
-
-	for (out_port_num = startoutport; out_port_num < endoutport;
-	     out_port_num++) {
-		p_physp = osm_node_get_physp_ptr(p_node, out_port_num);
-		for (in_port_num = startinport; in_port_num < endinport;
-		     in_port_num++)
-			osm_physp_set_slvl_tbl(p_physp, p_slvl_tbl, in_port_num);
+	OSM_LOG(sm->p_log, OSM_LOG_DEBUG, "Received SLtoVL GetResp"
+		" in_port_num %u out_port_num %u with GUID 0x%" PRIx64
+		" for parent node GUID 0x%" PRIx64 ", TID 0x%" PRIx64 "\n",
+		startinport == endinport ? startinport : 0xff,
+		startoutport == endoutport ? startoutport : 0xff,
+		cl_ntoh64(port_guid), cl_ntoh64(node_guid),
+		cl_ntoh64(p_smp->trans_id));
+
+	osm_dump_slvl_map_table(sm->p_log, port_guid,
+				startinport == endinport ? startinport : 0xff,
+				startoutport == endoutport ? startoutport : 0xff,
+				p_slvl_tbl, OSM_LOG_DEBUG);
+
+	for (out_port = startoutport; out_port <= endoutport; out_port++) {
+		p_physp = osm_node_get_physp_ptr(p_node, out_port);
+		for (in_port = startinport; in_port <= endinport; in_port++)
+			osm_physp_set_slvl_tbl(p_physp, p_slvl_tbl, in_port);
 	}
 
 Exit: