[ofa-general] [PATCH] opensm/osm_ucast_lash: find_port_from_lid() function is not used

Sasha Khapyorsky sashak at voltaire.com
Sat Jul 26 10:42:59 PDT 2008


This function is called only for the case when source and destination
switches are the same, so it is routing to itself and port number is
always '0'. The patch removes find_port_from_lid() function and its
usage.

Based on comments from: Keshetti Mahesh

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/opensm/osm_ucast_lash.c |   62 ++--------------------------------------
 1 files changed, 3 insertions(+), 59 deletions(-)

diff --git a/opensm/opensm/osm_ucast_lash.c b/opensm/opensm/osm_ucast_lash.c
index bb929b6..cc365db 100644
--- a/opensm/opensm/osm_ucast_lash.c
+++ b/opensm/opensm/osm_ucast_lash.c
@@ -153,59 +153,6 @@ static osm_switch_t *get_osm_switch_from_lid(osm_opensm_t * osm, uint16_t lid)
 	return get_osm_switch_from_port(port);
 }
 
-// This is a time consuming way to find a port from a lid
-// we will come up with a better way later
-static uint8_t find_port_from_lid(IN const ib_net16_t lid_no,
-				  IN const osm_switch_t * p_sw)
-{
-	uint8_t port_count = 0;
-	uint8_t i = 0;
-	osm_physp_t *p_current_physp, *p_remote_physp = NULL;
-	ib_port_info_t *port_info;
-	ib_net16_t port_lid;
-	uint8_t egress_port = 255;
-
-	if (p_sw->p_node)
-		port_count = osm_node_get_num_physp(p_sw->p_node);
-
-	// process management port first
-	p_current_physp = osm_node_get_physp_ptr(p_sw->p_node, 0);
-
-	port_info = &p_current_physp->port_info;
-	port_lid = port_info->base_lid;
-	if (port_lid == lid_no) {
-		egress_port = 0;
-		goto Exit;
-	}
-	// process each port on this switch
-	for (i = 1; i < port_count; i++) {
-
-		p_current_physp = osm_node_get_physp_ptr(p_sw->p_node, i);
-		if (!p_current_physp)
-			continue;
-
-		p_remote_physp = p_current_physp->p_remote_physp;
-
-		if (p_remote_physp) {
-			osm_node_t *p_opposite_node =
-			    osm_physp_get_node_ptr(p_remote_physp);
-
-			if (osm_node_get_type(p_opposite_node) ==
-			    IB_NODE_TYPE_CA) {
-				ib_port_info_t *pi = &p_remote_physp->port_info;
-				ib_net16_t remote_port_lid = pi->base_lid;
-				if (remote_port_lid == lid_no) {
-					egress_port = i;
-					goto Exit;
-				}
-			}
-		}
-	}			// for
-
-Exit:
-	return egress_port;
-}
-
 #if 0
 static int randint(int high)
 {
@@ -1135,17 +1082,14 @@ static void populate_fwd_tbls(lash_t * p_lash)
 			p_dst_sw = get_osm_switch_from_lid(p_lash->p_osm, lid);
 
 			if (p_dst_sw == p_sw) {
-				uint8_t egress_port =
-				    find_port_from_lid(cl_hton16(lid), p_sw);
-				p_osm->sm.ucast_mgr.lft_buf[lid] = egress_port;
+				p_osm->sm.ucast_mgr.lft_buf[lid] = 0;
 				OSM_LOG(p_log, OSM_LOG_VERBOSE,
 					"LASH fwd MY SRC SRC GUID 0x%016" PRIx64
 					" src lash id (%d), src lid no (0x%04X) src lash port (%d) "
 					"DST GUID 0x%016" PRIx64
 					" src lash id (%d), src lash port (%d)\n",
-					cl_ntoh64(current_guid), -1, lid,
-					egress_port, cl_ntoh64(current_guid),
-					-1, egress_port);
+					cl_ntoh64(current_guid), -1, lid, 0,
+					cl_ntoh64(current_guid), -1, 0);
 			} else if (p_dst_sw) {
 				unsigned dst_lash_switch_id =
 				    get_lash_id(p_dst_sw);
-- 
1.5.5.1.178.g1f811




More information about the general mailing list