How about if we just revert the devinfo.c change that used the new
conversion function?  I think "down" is a lot nicer in general than
"PORT_DOWN" so we might as well let new code use that.  But I do agree
we don't want to break any apps that are parsing ibv_devinfo output.

So the following seems like i twould work?

diff --git a/examples/devinfo.c b/examples/devinfo.c
index 86ad7da..caa5d5f 100644
--- a/examples/devinfo.c
+++ b/examples/devinfo.c
@@ -67,6 +67,17 @@ static const char *guid_str(uint64_t node_guid, char *str)
        return str;
 }
 
+static const char *port_state_str(enum ibv_port_state pstate)
+{
+       switch (pstate) {
+       case IBV_PORT_DOWN:   return "PORT_DOWN";
+       case IBV_PORT_INIT:   return "PORT_INIT";
+       case IBV_PORT_ARMED:  return "PORT_ARMED";
+       case IBV_PORT_ACTIVE: return "PORT_ACTIVE";
+       default:              return "invalid state";
+       }
+}
+
 static const char *port_phy_state_str(uint8_t phys_state)
 {
        switch (phys_state) {
@@ -254,7 +265,7 @@ static int print_hca_cap(struct ibv_device *ib_dev, uint8_t 
ib_port)
                }
                printf("\t\tport:\t%d\n", port);
                printf("\t\t\tstate:\t\t\t%s (%d)\n",
-                      ibv_port_state_str(port_attr.state), port_attr.state);
+                      port_state_str(port_attr.state), port_attr.state);
                printf("\t\t\tmax_mtu:\t\t%s (%d)\n",
                       mtu_str(port_attr.max_mtu), port_attr.max_mtu);
                printf("\t\t\tactive_mtu:\t\t%s (%d)\n",
_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to