When the IB port is down, the active_speed value returned by the MAD_IFC
command equals seven (7) which isn't among the IB speeds defined by the
ib_port_speed enum. This results in invalid speed value seen by higher
layers or applications who do port query. Fix that by setting the speed
to be SDR - the lowest possible when the port is down.
---
 drivers/infiniband/hw/mlx4/main.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/main.c 
b/drivers/infiniband/hw/mlx4/main.c
index 75d3056..b727094 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -253,6 +253,10 @@ static int ib_link_query_port(struct ib_device *ibdev, u8 
port,
                if (out_mad->data[15] & 0x1)
                        props->active_speed = IB_SPEED_FDR10;
        }
+
+       /* avoid wrong speed value returned by FW if the IB link is down */
+       if (props->state == IB_PORT_DOWN)
+                props->active_speed = IB_SPEED_SDR;
 out:
        kfree(in_mad);
        kfree(out_mad);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to