mlxsw: spectrum: Search for free LAD ID once
authorAmit Cohen <amcohen@nvidia.com>
Fri, 26 Jan 2024 18:58:29 +0000 (19:58 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 30 Jan 2024 14:47:36 +0000 (15:47 +0100)
commit8d8d33d4e38b5c60cdb3dcd6f190fcf91e306dd0
tree3a214477dc209bdb862088a4c8560ba3e62913f2
parentc6ca2884ba043e89c3588a77ce0724a7e5868f85
mlxsw: spectrum: Search for free LAD ID once

Currently, the function mlxsw_sp_lag_index_get() is called twice - first
as part of NETDEV_PRECHANGEUPPER event and later as part of
NETDEV_CHANGEUPPER. This function will be changed in the next patch. To
simplify the code, call it only once as part of NETDEV_CHANGEUPPER
event and set an error message using 'extack' in case of failure.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/mellanox/mlxsw/spectrum.c