[ofa-general] [PATCH] opensm/osmtest: update port chooser

Sasha Khapyorsky sashak at voltaire.com
Thu Nov 15 12:17:42 PST 2007


Minimalistic update of the osmtest port chooser - this will work in the
same fashion as it was before osm_vendor_get_all_port_attr() update.

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

diff --git a/opensm/osmtest/main.c b/opensm/osmtest/main.c
index 1c9004b..dade6da 100644
--- a/opensm/osmtest/main.c
+++ b/opensm/osmtest/main.c
@@ -263,15 +263,16 @@ ib_net64_t get_port_guid(IN osmtest_t * p_osmt, uint64_t port_guid)
 		return (0);
 	}
 
-	if (port_guid == 0 || num_ports == 1) {
+	if (num_ports == 1) {
 		printf("using default guid 0x%" PRIx64 "\n",
 		       cl_hton64(attr_array[0].port_guid));
 		return (attr_array[0].port_guid);
 	}
 
 	for (i = 0; i < num_ports; i++) {
-		if (attr_array[i].port_guid == port_guid)
-			return port_guid;
+		if (attr_array[i].port_guid == port_guid ||
+		    (!port_guid && attr_array[i].link_state > IB_LINK_DOWN))
+			return attr_array[i].port_guid;
 	}
 
 	return 0;
-- 
1.5.3.rc2.29.gc4640f




More information about the general mailing list