Skip to content

Commit 5dbf647

Browse files
danielj-mellanoxdavem330
authored andcommitted
net/mlx5: Use max_num_eqs_24b when setting max_io_eqs
Due a bug in the device max_num_eqs doesn't always reflect a written value. As a result, setting max_io_eqs may not work but appear successful. Instead write max_num_eqs_24b, which reflects correct value. Fixes: 93197c7 ("mlx5/core: Support max_io_eqs for a function") Signed-off-by: Daniel Jurgens <[email protected]> Reviewed-by: Parav Pandit <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 29c6a56 commit 5dbf647

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4600,20 +4600,26 @@ mlx5_devlink_port_fn_max_io_eqs_get(struct devlink_port *port, u32 *max_io_eqs,
46004600
return -EOPNOTSUPP;
46014601
}
46024602

4603+
if (!MLX5_CAP_GEN_2(esw->dev, max_num_eqs_24b)) {
4604+
NL_SET_ERR_MSG_MOD(extack,
4605+
"Device doesn't support getting the max number of EQs");
4606+
return -EOPNOTSUPP;
4607+
}
4608+
46034609
query_ctx = kzalloc(query_out_sz, GFP_KERNEL);
46044610
if (!query_ctx)
46054611
return -ENOMEM;
46064612

46074613
mutex_lock(&esw->state_lock);
46084614
err = mlx5_vport_get_other_func_cap(esw->dev, vport_num, query_ctx,
4609-
MLX5_CAP_GENERAL);
4615+
MLX5_CAP_GENERAL_2);
46104616
if (err) {
46114617
NL_SET_ERR_MSG_MOD(extack, "Failed getting HCA caps");
46124618
goto out;
46134619
}
46144620

46154621
hca_caps = MLX5_ADDR_OF(query_hca_cap_out, query_ctx, capability);
4616-
max_eqs = MLX5_GET(cmd_hca_cap, hca_caps, max_num_eqs);
4622+
max_eqs = MLX5_GET(cmd_hca_cap_2, hca_caps, max_num_eqs_24b);
46174623
if (max_eqs < MLX5_ESW_MAX_CTRL_EQS)
46184624
*max_io_eqs = 0;
46194625
else
@@ -4644,6 +4650,12 @@ mlx5_devlink_port_fn_max_io_eqs_set(struct devlink_port *port, u32 max_io_eqs,
46444650
return -EOPNOTSUPP;
46454651
}
46464652

4653+
if (!MLX5_CAP_GEN_2(esw->dev, max_num_eqs_24b)) {
4654+
NL_SET_ERR_MSG_MOD(extack,
4655+
"Device doesn't support changing the max number of EQs");
4656+
return -EOPNOTSUPP;
4657+
}
4658+
46474659
if (check_add_overflow(max_io_eqs, MLX5_ESW_MAX_CTRL_EQS, &max_eqs)) {
46484660
NL_SET_ERR_MSG_MOD(extack, "Supplied value out of range");
46494661
return -EINVAL;
@@ -4655,17 +4667,17 @@ mlx5_devlink_port_fn_max_io_eqs_set(struct devlink_port *port, u32 max_io_eqs,
46554667

46564668
mutex_lock(&esw->state_lock);
46574669
err = mlx5_vport_get_other_func_cap(esw->dev, vport_num, query_ctx,
4658-
MLX5_CAP_GENERAL);
4670+
MLX5_CAP_GENERAL_2);
46594671
if (err) {
46604672
NL_SET_ERR_MSG_MOD(extack, "Failed getting HCA caps");
46614673
goto out;
46624674
}
46634675

46644676
hca_caps = MLX5_ADDR_OF(query_hca_cap_out, query_ctx, capability);
4665-
MLX5_SET(cmd_hca_cap, hca_caps, max_num_eqs, max_eqs);
4677+
MLX5_SET(cmd_hca_cap_2, hca_caps, max_num_eqs_24b, max_eqs);
46664678

46674679
err = mlx5_vport_set_other_func_cap(esw->dev, hca_caps, vport_num,
4668-
MLX5_SET_HCA_CAP_OP_MOD_GENERAL_DEVICE);
4680+
MLX5_SET_HCA_CAP_OP_MOD_GENERAL_DEVICE2);
46694681
if (err)
46704682
NL_SET_ERR_MSG_MOD(extack, "Failed setting HCA caps");
46714683

0 commit comments

Comments
 (0)