]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net/mlx5: E-Switch, align disable sequence with switchdev-to-legacy transition
authorShay Drory <shayd@nvidia.com>
Sun, 31 May 2026 11:39:42 +0000 (14:39 +0300)
committerJakub Kicinski <kuba@kernel.org>
Thu, 4 Jun 2026 00:42:19 +0000 (17:42 -0700)
This patch align the eswitch disable sequence with the
switchdev-to-legacy mode transition, where eswitch must be disabled
before device detachment. The consistent ordering is required for proper
SD LAG cleanup which depends on eswitch state during teardown.

Signed-off-by: Shay Drory <shayd@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20260531113954.395443-3-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/main.c

index 0c6e4efe38c839ad08d747b638ec91d4589f84a6..fd285aeb9630d95b09563c44f5d1e641138f814d 100644 (file)
@@ -1369,7 +1369,6 @@ err_irq_table:
 
 static void mlx5_unload(struct mlx5_core_dev *dev)
 {
-       mlx5_eswitch_disable(dev->priv.eswitch);
        mlx5_devlink_traps_unregister(priv_to_devlink(dev));
        mlx5_vhca_event_stop(dev);
        mlx5_sf_dev_table_destroy(dev);
@@ -1484,6 +1483,7 @@ void mlx5_uninit_one(struct mlx5_core_dev *dev)
 
        mlx5_hwmon_dev_unregister(dev);
        mlx5_crdump_disable(dev);
+       mlx5_eswitch_disable(dev->priv.eswitch);
        mlx5_unregister_device(dev);
 
        if (!test_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state)) {
@@ -1568,6 +1568,7 @@ void mlx5_unload_one_devl_locked(struct mlx5_core_dev *dev, bool suspend)
        devl_assert_locked(priv_to_devlink(dev));
        mutex_lock(&dev->intf_state_mutex);
 
+       mlx5_eswitch_disable(dev->priv.eswitch);
        mlx5_detach_device(dev, suspend);
 
        if (!test_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state)) {