diff mbox

opensm/osm_get_port_by_lid(): speedup a port lookup

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

Commit Message

Sasha Khapyorsky Sept. 29, 2009, 11:02 a.m. UTC
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@voltaire.com>
---
 opensm/opensm/osm_subnet.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff mbox

Patch

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;
 	}