]> git.dujemihanovic.xyz Git - linux.git/commitdiff
net/mlx5e: Set uplink rep as NETNS_LOCAL
authorGavin Li <gavinl@nvidia.com>
Fri, 25 Nov 2022 02:15:40 +0000 (04:15 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Tue, 21 Mar 2023 21:06:31 +0000 (14:06 -0700)
Previously, NETNS_LOCAL was not set for uplink representors, inconsistent
with VF representors, and allowed the uplink representor to be moved
between net namespaces and separated from the VF representors it shares
the core device with. Such usage would break the isolation model of
namespaces, as devices in different namespaces would have access to
shared memory.

To solve this issue, set NETNS_LOCAL for uplink representors if eswitch is
in switchdev mode.

Fixes: 7a9fb35e8c3a ("net/mlx5e: Do not reload ethernet ports when changing eswitch mode")
Signed-off-by: Gavin Li <gavinl@nvidia.com>
Reviewed-by: Gavi Teitz <gavi@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en_main.c

index a7f2ab22cc40c7094bde99edf5421984d8758b7a..7ca7e9b57607fdfa2484cf374d5b2cfa7f731bf3 100644 (file)
@@ -4150,8 +4150,12 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev,
                }
        }
 
-       if (mlx5e_is_uplink_rep(priv))
+       if (mlx5e_is_uplink_rep(priv)) {
                features = mlx5e_fix_uplink_rep_features(netdev, features);
+               features |= NETIF_F_NETNS_LOCAL;
+       } else {
+               features &= ~NETIF_F_NETNS_LOCAL;
+       }
 
        mutex_unlock(&priv->state_lock);