diff options
author | Jianbo Liu <jianbol@nvidia.com> | 2025-09-29 00:25:18 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2025-09-30 17:21:14 -0700 |
commit | 06fdc45f16c392dc3394c67e7c17ae63935715d3 (patch) | |
tree | 98f58565cb4cc6d028e1c2dcb61eef3ea5c04b4f /rust/helpers/build_assert.c | |
parent | 906154caa7d3d750d47cd18f9349b75b77e12854 (diff) |
net/mlx5e: Prevent entering switchdev mode with inconsistent netns
When a PF enters switchdev mode, its netdevice becomes the uplink
representor but remains in its current network namespace. All other
representors (VFs, SFs) are created in the netns of the devlink
instance.
If the PF's netns has been moved and differs from the devlink's netns,
enabling switchdev mode would create a state where the OVS control
plane (ovs-vsctl) cannot manage the switch because the PF uplink
representor and the other representors are split across different
namespaces.
To prevent this inconsistent configuration, block the request to enter
switchdev mode if the PF netdevice's netns does not match the netns of
its devlink instance.
As part of this change, the PF's netns is first marked as immutable.
This prevents race conditions where the netns could be changed after
the check is performed but before the mode transition is complete, and
it aligns the PF's behavior with that of the final uplink representor.
Signed-off-by: Jianbo Liu <jianbol@nvidia.com>
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/1759094723-843774-3-git-send-email-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'rust/helpers/build_assert.c')
0 files changed, 0 insertions, 0 deletions