]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
net/mlx5: E-Switch, rebuild lag only when needed
authorMark Bloch <mbloch@nvidia.com>
Wed, 10 Nov 2021 15:19:12 +0000 (15:19 +0000)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 7 Dec 2021 06:34:11 +0000 (07:34 +0100)
commit97e6f505695761c63bd787bc943c117a9eed7a0b
treee215fb7c2dc0fd24ba765c684dcabd5bc188f64a
parent0c91fbc24932b1ea743bbd95634791f8d42f7386
net/mlx5: E-Switch, rebuild lag only when needed

BugLink: https://bugs.launchpad.net/bugs/1952579
[ Upstream commit 2eb0cb31bc4ce2ede5460cf3ef433b40cf5f040d ]

A user can enable VFs without changing E-Switch mode, this can happen
when a user moves straight to switchdev mode and only once in switchdev
VFs are enabled via the sysfs interface.

The cited commit assumed this isn't possible and exposed a single
API function where the E-switch calls into the lag code, breaks the lag
and prevents any other lag operations to take place until the
E-switch update has ended.

Breaking the hardware lag when it isn't needed can make it such that
hardware lag can't be enabled again.

In the sysfs call path check if the current E-Switch mode is NONE,
in the context of the function it can only mean the E-Switch is moving
out of NONE mode and the hardware lag should be disabled and enabled
once the mode change has ended. If the mode isn't NONE it means
VFs are about to be enabled and such operation doesn't require
toggling the hardware lag.

Fixes: cac1eb2cf2e3 ("net/mlx5: Lag, properly lock eswitch if needed")
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c