18247164 SUNBT7167127 Some OFED tools print errors with a connect-x VPI card (userland)
authorBoris Chiu <boris.chiu@oracle.com>
Fri, 07 Mar 2014 07:55:00 -0800
changeset 1749 6a6f92e9feaf
parent 1748 5b1802fcf350
child 1750 cae903cb1692
18247164 SUNBT7167127 Some OFED tools print errors with a connect-x VPI card (userland)
components/open-fabrics/infiniband-diags/patches/base.patch
components/open-fabrics/libibverbs/solaris_compatibility.c
--- a/components/open-fabrics/infiniband-diags/patches/base.patch	Fri Mar 07 05:21:08 2014 -0500
+++ b/components/open-fabrics/infiniband-diags/patches/base.patch	Fri Mar 07 07:55:00 2014 -0800
@@ -1868,7 +1868,66 @@
 diff -r -u /tmp/infiniband-diags-1.5.8/src/ibstat.c infiniband-diags-1.5.8/src/ibstat.c
 --- /tmp/infiniband-diags-1.5.8/src/ibstat.c	Wed Feb 16 02:13:21 2011
 +++ infiniband-diags-1.5.8/src/ibstat.c	Fri Feb 25 03:09:28 2011
-@@ -245,7 +245,7 @@
+@@ -46,6 +46,7 @@
+ 
+ #include <infiniband/umad.h>
+ #include <infiniband/mad.h>
++#include <infiniband/verbs.h>
+ 
+ #include <ibdiag_common.h>
+ 
+@@ -78,7 +79,7 @@
+ }
+ 
+ static char *port_state_str[] = {
+-	"???",
++	"Unknown",
+ 	"Down",
+ 	"Initializing",
+ 	"Armed",
+@@ -96,6 +97,19 @@
+ 	"PhyTest"
+ };
+ 
++static const char *port_link_layer_str(uint8_t link_layer)
++{
++	switch (link_layer) {
++		case IBV_LINK_LAYER_UNSPECIFIED:
++		case IBV_LINK_LAYER_INFINIBAND:
++			return "IB";
++		case IBV_LINK_LAYER_ETHERNET:
++			return "Ethernet";
++		default:
++			return "Unknown";
++        }
++};
++
+ static int port_dump(umad_port_t * port, int alone)
+ {
+ 	char *pre = "";
+@@ -112,10 +126,10 @@
+ 	printf("%sPort %d:\n", hdrpre, port->portnum);
+ 	printf("%sState: %s\n", pre,
+ 	       (unsigned)port->state <=
+-	       4 ? port_state_str[port->state] : "???");
++	       4 ? port_state_str[port->state] : "Unknown");
+ 	printf("%sPhysical state: %s\n", pre,
+ 	       (unsigned)port->phys_state <=
+-	       7 ? port_phy_state_str[port->phys_state] : "???");
++	       7 ? port_phy_state_str[port->phys_state] : "Unknown");
+ 	printf("%sRate: %d\n", pre, port->rate);
+ 	printf("%sBase lid: %d\n", pre, port->base_lid);
+ 	printf("%sLMC: %d\n", pre, port->lmc);
+@@ -122,7 +136,7 @@
+ 	printf("%sSM lid: %d\n", pre, port->sm_lid);
+ 	printf("%sCapability mask: 0x%08x\n", pre, ntohl(port->capmask));
+ 	printf("%sPort GUID: 0x%016" PRIx64 "\n", pre, ntohll(port->port_guid));
+-	printf("%sLink layer: %s\n", pre, port->link_layer);
++	printf("%sLink layer: %s\n", pre, port_link_layer_str(atoi(port->link_layer)));
+ 	return 0;
+ }
+ 
+@@ -245,7 +259,7 @@
  		if (i >= n)
  			IBPANIC("'%s' IB device can't be found", argv[0]);
  
--- a/components/open-fabrics/libibverbs/solaris_compatibility.c	Fri Mar 07 05:21:08 2014 -0500
+++ b/components/open-fabrics/libibverbs/solaris_compatibility.c	Fri Mar 07 07:55:00 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -1143,6 +1143,8 @@
 		} else if (strcmp(path, "cap_mask") == 0) {
 			len = 1 + sprintf(buf, "0x%08x",
 			    port_attr.port_cap_flags);
+		} else if (strcmp(path, "link_layer") == 0) {
+			len = 1 + sprintf(buf, "%d", port_attr.link_layer);
 		}
 	}
 exit: