]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
net/mlx5e: Block entering switchdev mode with ns inconsistency
authorGavin Li <gavinl@nvidia.com>
Thu, 9 Feb 2023 10:48:52 +0000 (12:48 +0200)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Wed, 17 May 2023 11:33:30 +0000 (13:33 +0200)
commita6fe6b3c2eab35bd25cb769e1887acc84233dad6
tree4864c8892b0c63d1715e7d1144af0e587d2e84a2
parentfac987dc99e2eeeae709711f412ca873be6f1085
net/mlx5e: Block entering switchdev mode with ns inconsistency

BugLink: https://bugs.launchpad.net/bugs/2016877
[ Upstream commit 662404b24a4c4d839839ed25e3097571f5938b9b ]

Upon entering switchdev mode, VF/SF representors are spawned in the
devlink instance's net namespace, whereas the PF net device transforms
into the uplink representor, remaining in the net namespace the PF net
device was in. Therefore, if a PF net device's namespace is different from
its parent devlink net namespace, entering switchdev mode can create an
illegal situation where all representors sharing the same core device
are NOT in the same net namespace.

To avoid this issue, block entering switchdev mode for devices whose child
netdev net namespace has diverged from the parent devlink's.

Fixes: 7768d1971de6 ("net/mlx5: E-Switch, Add control for encapsulation")
Signed-off-by: Gavin Li <gavinl@nvidia.com>
Reviewed-by: Gavi Teitz <gavi@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c