]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net/mlx5: make enable_mpesw idempotent
authorMoshe Shemesh <moshe@nvidia.com>
Mon, 1 Dec 2025 15:13:27 +0000 (17:13 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 4 Dec 2025 10:55:20 +0000 (11:55 +0100)
commitcd7671ef4cf2edf73cd2a3dca3a2f522a4525bf5
treec322aea6a802cdc1854796d3e4d42e3ebb1aaee6
parentce052b9402e461a9aded599f5b47e76bc727f7de
net/mlx5: make enable_mpesw idempotent

The enable_mpesw() function returns -EINVAL if ldev->mode is not
MLX5_LAG_MODE_NONE. This means attempting to enable MPESW mode when it's
already enabled will fail. In contrast, disable_mpesw() properly checks
if the mode is MLX5_LAG_MODE_MPESW before proceeding, making it
naturally idempotent and safe to call multiple times.

Fix enable_mpesw() to return success if mpesw is already enabled.

Fixes: a32327a3a02c ("net/mlx5: Lag, Control MultiPort E-Switch single FDB mode")
Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
Reviewed-by: Shay Drori <shayd@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/1764602008-1334866-2-git-send-email-tariqt@nvidia.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c