[ofa-general] [PATCH] opensm/osm_get_port_by_lid(): speedup a port lookup

Sasha Khapyorsky sashak at voltaire.com
Tue Sep 29 04:02:44 PDT 2009


Speedup a port lookup over LMC array - it is not necessary to match LMC
exactly for found port because base lid should be equal to requested lid
masked value, so '<=' comparison should be enough and we don't need to
loop up to an actual port's lmc value match.

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

diff --git a/opensm/opensm/osm_subnet.c b/opensm/opensm/osm_subnet.c
index 67bc7e1..30f8af5 100644
--- a/opensm/opensm/osm_subnet.c
+++ b/opensm/opensm/osm_subnet.c
@@ -661,7 +661,7 @@ osm_port_t *osm_get_port_by_lid(IN osm_subn_t const * subn, IN ib_net16_t lid)
 		port = cl_ptr_vector_get(&subn->port_lid_tbl, base_lid);
 		/* Determine if base LID "tested" is the real base LID */
 		/* This is true if the LMC "tested" is the port's actual LMC */
-		if (port && lmc == osm_port_get_lmc(port))
+		if (port && lmc <= osm_port_get_lmc(port))
 			return port;
 	}
 
-- 
1.6.5.rc1




More information about the general mailing list