Skip to content

Commit 8d654fa

Browse files
dtatuleagregkh
authored andcommitted
net/mlx5: Check max_macs devlink param value against max capability
[ Upstream commit d7b0413 ] The max_macs devlink param is checked against the FW max value only at param register time (driver load) and inside the validate callback (devlink param set). The stored DRIVERINIT value persists across FW resets and devlink reloads without any further checks against the max. If the FW link type changes from Ethernet to IB and a FW reset happens, the MAX cap for log_max_current_uc_list will become zero, but the previously stored max_macs value remains and is unconditionally programmed into the HCA caps in handle_hca_cap(). FW will then return a syndrome during SET_HCA_CAP: mlx5_cmd_out_err:839:(pid 3831): SET_HCA_CAP(0x109) op_mod(0x0) failed, status bad parameter(0x3), syndrome (0x537801), err(-22) set_hca_cap:907:(pid 3831): handle_hca_cap failed This results in a failure to register the RDMA device. This patch skips programming log_max_current_uc_list when the MAX capability is 0 (in case of IB). Fixes: 8680a60 ("net/mlx5: Let user configure max_macs generic param") Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com> Reviewed-by: Yael Chemla <ychemla@nvidia.com> Reviewed-by: Carolina Jubran <cjubran@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com> Link: https://patch.msgid.link/20260611135230.534513-1-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent b6dced2 commit 8d654fa

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

  • drivers/net/ethernet/mellanox/mlx5/core

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,6 @@ static int handle_hca_cap(struct mlx5_core_dev *dev, void *set_ctx)
570570
{
571571
struct mlx5_profile *prof = &dev->profile;
572572
void *set_hca_cap;
573-
int max_uc_list;
574573
int err;
575574

576575
err = mlx5_core_get_caps(dev, MLX5_CAP_GENERAL);
@@ -653,10 +652,13 @@ static int handle_hca_cap(struct mlx5_core_dev *dev, void *set_ctx)
653652
MLX5_SET(cmd_hca_cap, set_hca_cap, roce,
654653
mlx5_is_roce_on(dev));
655654

656-
max_uc_list = max_uc_list_get_devlink_param(dev);
657-
if (max_uc_list > 0)
658-
MLX5_SET(cmd_hca_cap, set_hca_cap, log_max_current_uc_list,
659-
ilog2(max_uc_list));
655+
if (MLX5_CAP_GEN_MAX(dev, log_max_current_uc_list)) {
656+
int max_uc_list = max_uc_list_get_devlink_param(dev);
657+
658+
if (max_uc_list > 0)
659+
MLX5_SET(cmd_hca_cap, set_hca_cap,
660+
log_max_current_uc_list, ilog2(max_uc_list));
661+
}
660662

661663
return set_caps(dev, set_ctx, MLX5_SET_HCA_CAP_OP_MOD_GENERAL_DEVICE);
662664
}

0 commit comments

Comments
 (0)