aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2008-06-24 19:32:27 -0700
committerRoland Dreier <rolandd@cisco.com>2008-06-24 19:32:27 -0700
commit99d055285ba1bf6b925dda1578fa21e49de89caa (patch)
treee6dbc9ebb5582e0a5e92347491865b15363cbfb2
parent3962cf1745f86429018d9d24a392838c686bf5a6 (diff)
downloadlibibverbs-99d055285ba1bf6b925dda1578fa21e49de89caa.tar.gz
Revert conversion of ibv_devinfo to use ibv_port_state_str()
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>
-rw-r--r--examples/devinfo.c13
1 files changed, 12 insertions, 1 deletions
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",