]> git.openfabrics.org - ~shefty/libibverbs.git/commitdiff
Revert conversion of ibv_devinfo to use ibv_port_state_str()
authorRoland Dreier <rolandd@cisco.com>
Wed, 25 Jun 2008 02:32:27 +0000 (19:32 -0700)
committerRoland Dreier <rolandd@cisco.com>
Wed, 25 Jun 2008 02:32:27 +0000 (19:32 -0700)
Using ibv_port_state_str() changes the port state output of ibv_devinfo
(eg "PORT_DOWN" becomes "down"), which is reported to break scripts that
parse this output.  Revert to using the old code in ibv_devinfo; we want
ibv_port_state_str() to continue producing the nicer-looking lower case
output, so just leave the open-coded alternative in ibv_devinfo.

Reported-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
examples/devinfo.c

index 86ad7da2a5dc516df0350bbd9750bc0fd5596b28..caa5d5f6b430abb07d45acbb1070474edd5a4664 100644 (file)
@@ -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",