]> git.baikalelectronics.ru Git - 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)
committerSaeed Mahameed <saeedm@nvidia.com>
Tue, 16 Nov 2021 20:20:21 +0000 (12:20 -0800)
commitfb772fedffab839592ab18ab65025931c010dde5
treea70f875640a3cbb45b8a18f68a7b90ead001fe05
parent8abf1d74e488965f4133b1f941ddc2a8f39ad507
net/mlx5: E-Switch, rebuild lag only when needed

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: a6669ad308fe ("net/mlx5: Lag, properly lock eswitch if needed")
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c