* [PATCH net] net/mlx5: Check max_macs devlink param value against max capability
@ 2026-06-11 13:52 Tariq Toukan
2026-06-11 15:48 ` Alexander Lobakin
2026-06-13 1:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Tariq Toukan @ 2026-06-11 13:52 UTC (permalink / raw)
To: Eric Dumazet, Jakub Kicinski, Paolo Abeni, Andrew Lunn,
David S. Miller
Cc: Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Mark Bloch,
Moshe Shemesh, Shay Drory, Parav Pandit, netdev, linux-rdma,
linux-kernel, Gal Pressman, Dragos Tatulea, Yael Chemla,
Carolina Jubran
From: Dragos Tatulea <dtatulea@nvidia.com>
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: 8680a60fc1fc ("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>
---
drivers/net/ethernet/mellanox/mlx5/core/main.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 74827e8ca125..37af619e5e04 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -527,7 +527,6 @@ static int handle_hca_cap(struct mlx5_core_dev *dev, void *set_ctx)
{
struct mlx5_profile *prof = &dev->profile;
void *set_hca_cap;
- int max_uc_list;
int err;
err = mlx5_core_get_caps(dev, MLX5_CAP_GENERAL);
@@ -610,10 +609,13 @@ static int handle_hca_cap(struct mlx5_core_dev *dev, void *set_ctx)
MLX5_SET(cmd_hca_cap, set_hca_cap, roce,
mlx5_is_roce_on(dev));
- max_uc_list = max_uc_list_get_devlink_param(dev);
- if (max_uc_list > 0)
- MLX5_SET(cmd_hca_cap, set_hca_cap, log_max_current_uc_list,
- ilog2(max_uc_list));
+ if (MLX5_CAP_GEN_MAX(dev, log_max_current_uc_list)) {
+ int max_uc_list = max_uc_list_get_devlink_param(dev);
+
+ if (max_uc_list > 0)
+ MLX5_SET(cmd_hca_cap, set_hca_cap,
+ log_max_current_uc_list, ilog2(max_uc_list));
+ }
/* enable absolute native port num */
if (MLX5_CAP_GEN_MAX(dev, abs_native_port_num))
base-commit: 0068940907d33217ae01217f84910a5cde606c17
--
2.44.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net] net/mlx5: Check max_macs devlink param value against max capability
2026-06-11 13:52 [PATCH net] net/mlx5: Check max_macs devlink param value against max capability Tariq Toukan
@ 2026-06-11 15:48 ` Alexander Lobakin
2026-06-13 1:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Alexander Lobakin @ 2026-06-11 15:48 UTC (permalink / raw)
To: Tariq Toukan
Cc: Eric Dumazet, Jakub Kicinski, Paolo Abeni, Andrew Lunn,
David S. Miller, Saeed Mahameed, Leon Romanovsky, Mark Bloch,
Moshe Shemesh, Shay Drory, Parav Pandit, netdev, linux-rdma,
linux-kernel, Gal Pressman, Dragos Tatulea, Yael Chemla,
Carolina Jubran
From: Tariq Toukan <tariqt@nvidia.com>
Date: Thu, 11 Jun 2026 16:52:30 +0300
> From: Dragos Tatulea <dtatulea@nvidia.com>
>
> 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: 8680a60fc1fc ("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>
Thanks,
Olek
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net] net/mlx5: Check max_macs devlink param value against max capability
2026-06-11 13:52 [PATCH net] net/mlx5: Check max_macs devlink param value against max capability Tariq Toukan
2026-06-11 15:48 ` Alexander Lobakin
@ 2026-06-13 1:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-06-13 1:50 UTC (permalink / raw)
To: Tariq Toukan
Cc: edumazet, kuba, pabeni, andrew+netdev, davem, saeedm, leon,
mbloch, moshe, shayd, parav, netdev, linux-rdma, linux-kernel,
gal, dtatulea, ychemla, cjubran
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 11 Jun 2026 16:52:30 +0300 you wrote:
> From: Dragos Tatulea <dtatulea@nvidia.com>
>
> 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.
>
> [...]
Here is the summary with links:
- [net] net/mlx5: Check max_macs devlink param value against max capability
https://git.kernel.org/netdev/net/c/d7b0413b3571
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-13 1:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-11 13:52 [PATCH net] net/mlx5: Check max_macs devlink param value against max capability Tariq Toukan
2026-06-11 15:48 ` Alexander Lobakin
2026-06-13 1:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox