summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mlx4
diff options
context:
space:
mode:
authorOr Gerlitz <ogerlitz@mellanox.com>2012-04-02 17:45:20 +0300
committerRoland Dreier <roland@purestorage.com>2012-04-02 10:55:24 -0700
commitd2ef406866620f0450ad0b4c7fb5c2796c7bf245 (patch)
tree0d44c40c7da3b28f4edfb371cf782ae3f0c5c4c1 /drivers/infiniband/hw/mlx4
parentdd775ae2549217d3ae09363e3edb305d0fa19928 (diff)
IB/mlx4: Don't return an invalid speed when a port is down
When the IB port is down, the active_speed value returned by the MAD_IFC command is seven (7) which isn't among the defined IB speeds in enum ib_port_speed, and this invalid speed value is passed up to 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. Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/hw/mlx4')
-rw-r--r--drivers/infiniband/hw/mlx4/main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 75d30562930..669673e8143 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -253,6 +253,11 @@ 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);