aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mlx5/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/mlx5/main.c')
-rw-r--r--drivers/infiniband/hw/mlx5/main.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index e9c428071df3..3569fda07e07 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -1094,31 +1094,26 @@ enum mlx5_ib_width {
1094 MLX5_IB_WIDTH_12X = 1 << 4 1094 MLX5_IB_WIDTH_12X = 1 << 4
1095}; 1095};
1096 1096
1097static int translate_active_width(struct ib_device *ibdev, u8 active_width, 1097static void translate_active_width(struct ib_device *ibdev, u8 active_width,
1098 u8 *ib_width) 1098 u8 *ib_width)
1099{ 1099{
1100 struct mlx5_ib_dev *dev = to_mdev(ibdev); 1100 struct mlx5_ib_dev *dev = to_mdev(ibdev);
1101 int err = 0;
1102 1101
1103 if (active_width & MLX5_IB_WIDTH_1X) { 1102 if (active_width & MLX5_IB_WIDTH_1X)
1104 *ib_width = IB_WIDTH_1X; 1103 *ib_width = IB_WIDTH_1X;
1105 } else if (active_width & MLX5_IB_WIDTH_2X) { 1104 else if (active_width & MLX5_IB_WIDTH_4X)
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) {
1110 *ib_width = IB_WIDTH_4X; 1105 *ib_width = IB_WIDTH_4X;
1111 } else if (active_width & MLX5_IB_WIDTH_8X) { 1106 else if (active_width & MLX5_IB_WIDTH_8X)
1112 *ib_width = IB_WIDTH_8X; 1107 *ib_width = IB_WIDTH_8X;
1113 } else if (active_width & MLX5_IB_WIDTH_12X) { 1108 else if (active_width & MLX5_IB_WIDTH_12X)
1114 *ib_width = IB_WIDTH_12X; 1109 *ib_width = IB_WIDTH_12X;
1115 } else { 1110 else {
1116 mlx5_ib_dbg(dev, "Invalid active_width %d\n", 1111 mlx5_ib_dbg(dev, "Invalid active_width %d, setting width to default value: 4x\n",
1117 (int)active_width); 1112 (int)active_width);
1118 err = -EINVAL; 1113 *ib_width = IB_WIDTH_4X;
1119 } 1114 }
1120 1115
1121 return err; 1116 return;
1122} 1117}
1123 1118
1124static int mlx5_mtu_to_ib_mtu(int mtu) 1119static int mlx5_mtu_to_ib_mtu(int mtu)
@@ -1225,10 +1220,8 @@ static int mlx5_query_hca_port(struct ib_device *ibdev, u8 port,
1225 if (err) 1220 if (err)
1226 goto out; 1221 goto out;
1227 1222
1228 err = translate_active_width(ibdev, ib_link_width_oper, 1223 translate_active_width(ibdev, ib_link_width_oper, &props->active_width);
1229 &props->active_width); 1224
1230 if (err)
1231 goto out;
1232 err = mlx5_query_port_ib_proto_oper(mdev, &props->active_speed, port); 1225 err = mlx5_query_port_ib_proto_oper(mdev, &props->active_speed, port);
1233 if (err) 1226 if (err)
1234 goto out; 1227 goto out;