From 99d055285ba1bf6b925dda1578fa21e49de89caa Mon Sep 17 00:00:00 2001 From: Roland Dreier Date: Tue, 24 Jun 2008 19:32:27 -0700 Subject: [PATCH] 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 Signed-off-by: Roland Dreier --- examples/devinfo.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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", -- 2.46.0