]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Revert "net/mlx5: Block entering switchdev mode with ns inconsistency"
authorGavin Li <gavinl@nvidia.com>
Tue, 27 Jan 2026 05:17:07 +0000 (13:17 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Feb 2026 15:44:23 +0000 (16:44 +0100)
[ Upstream commit 8deeefb24786ea7950b37bde4516b286c877db00 ]

This reverts commit 662404b24a4c4d839839ed25e3097571f5938b9b.
The revert is required due to the suspicion it is not good for anything
and cause crash.

Fixes: 662404b24a4c ("net/mlx5e: Block entering switchdev mode with ns inconsistency")
Signed-off-by: Gavin Li <gavinl@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
[ The context change is due to the commit e25373416678
("net/mlx5e: Rewrite IPsec vs. TC block interface") in v6.6
which is irrelevant to the logic of this patch. ]
Signed-off-by: Rahul Sharma <black.hawk@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c

index 5237abbdcda117ebdd4185c056e04a05045317cd..f7f1eae998b5e73e1f08e35c408a1d45eb94ec4b 100644 (file)
@@ -3493,18 +3493,6 @@ static int esw_inline_mode_to_devlink(u8 mlx5_mode, u8 *mode)
        return 0;
 }
 
-static bool esw_offloads_devlink_ns_eq_netdev_ns(struct devlink *devlink)
-{
-       struct net *devl_net, *netdev_net;
-       struct mlx5_eswitch *esw;
-
-       esw = mlx5_devlink_eswitch_get(devlink);
-       netdev_net = dev_net(esw->dev->mlx5e_res.uplink_netdev);
-       devl_net = devlink_net(devlink);
-
-       return net_eq(devl_net, netdev_net);
-}
-
 int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode,
                                  struct netlink_ext_ack *extack)
 {
@@ -3519,13 +3507,6 @@ int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode,
        if (esw_mode_from_devlink(mode, &mlx5_mode))
                return -EINVAL;
 
-       if (mode == DEVLINK_ESWITCH_MODE_SWITCHDEV &&
-           !esw_offloads_devlink_ns_eq_netdev_ns(devlink)) {
-               NL_SET_ERR_MSG_MOD(extack,
-                                  "Can't change E-Switch mode to switchdev when netdev net namespace has diverged from the devlink's.");
-               return -EPERM;
-       }
-
        mlx5_lag_disable_change(esw->dev);
        err = mlx5_esw_try_lock(esw);
        if (err < 0) {