Skip to content

Commit a990756

Browse files
gurmichaelgregkh
authored andcommitted
IB/mlx5: Avoid load failure due to unknown link width
commit db7a691 upstream. If the firmware reports a connection width that is not 1x, 4x, 8x or 12x it causes the driver to fail during initialization. To prevent this failure every time a new width is introduced to the RDMA stack, we will set a default 4x width for these widths which ar unknown to the driver. This is needed to allow to run old kernels with new firmware. Cc: <stable@vger.kernel.org> # 4.1 Fixes: 1b5daf1 ("IB/mlx5: Avoid using the MAD_IFC command under ISSI > 0 mode") Signed-off-by: Michael Guralnik <michaelgur@mellanox.com> Reviewed-by: Majd Dibbiny <majd@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a41e946 commit a990756

1 file changed

Lines changed: 11 additions & 18 deletions

File tree

  • drivers/infiniband/hw/mlx5

‎drivers/infiniband/hw/mlx5/main.c‎

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,31 +1094,26 @@ enum mlx5_ib_width {
10941094
MLX5_IB_WIDTH_12X = 1 << 4
10951095
};
10961096

1097-
static int translate_active_width(struct ib_device *ibdev, u8 active_width,
1097+
static void translate_active_width(struct ib_device *ibdev, u8 active_width,
10981098
u8 *ib_width)
10991099
{
11001100
struct mlx5_ib_dev *dev = to_mdev(ibdev);
1101-
int err = 0;
11021101

1103-
if (active_width & MLX5_IB_WIDTH_1X) {
1102+
if (active_width & MLX5_IB_WIDTH_1X)
11041103
*ib_width = IB_WIDTH_1X;
1105-
} else if (active_width & MLX5_IB_WIDTH_2X) {
1106-
mlx5_ib_dbg(dev, "active_width %d is not supported by IB spec\n",
1107-
(int)active_width);
1108-
err = -EINVAL;
1109-
} else if (active_width & MLX5_IB_WIDTH_4X) {
1104+
else if (active_width & MLX5_IB_WIDTH_4X)
11101105
*ib_width = IB_WIDTH_4X;
1111-
} else if (active_width & MLX5_IB_WIDTH_8X) {
1106+
else if (active_width & MLX5_IB_WIDTH_8X)
11121107
*ib_width = IB_WIDTH_8X;
1113-
} else if (active_width & MLX5_IB_WIDTH_12X) {
1108+
else if (active_width & MLX5_IB_WIDTH_12X)
11141109
*ib_width = IB_WIDTH_12X;
1115-
} else {
1116-
mlx5_ib_dbg(dev, "Invalid active_width %d\n",
1110+
else {
1111+
mlx5_ib_dbg(dev, "Invalid active_width %d, setting width to default value: 4x\n",
11171112
(int)active_width);
1118-
err = -EINVAL;
1113+
*ib_width = IB_WIDTH_4X;
11191114
}
11201115

1121-
return err;
1116+
return;
11221117
}
11231118

11241119
static int mlx5_mtu_to_ib_mtu(int mtu)
@@ -1225,10 +1220,8 @@ static int mlx5_query_hca_port(struct ib_device *ibdev, u8 port,
12251220
if (err)
12261221
goto out;
12271222

1228-
err = translate_active_width(ibdev, ib_link_width_oper,
1229-
&props->active_width);
1230-
if (err)
1231-
goto out;
1223+
translate_active_width(ibdev, ib_link_width_oper, &props->active_width);
1224+
12321225
err = mlx5_query_port_ib_proto_oper(mdev, &props->active_speed, port);
12331226
if (err)
12341227
goto out;

0 commit comments

Comments
 (0)