mlxsw: spectrum: Query max_lag once
authorAmit Cohen <amcohen@nvidia.com>
Fri, 26 Jan 2024 18:58:28 +0000 (19:58 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 30 Jan 2024 14:47:35 +0000 (15:47 +0100)
commitc6ca2884ba043e89c3588a77ce0724a7e5868f85
tree234b5d02204163bdeae5fbc19f12cbea02898ede
parent5a448905e37ecf121ede090495540230b5d03946
mlxsw: spectrum: Query max_lag once

The maximum number of LAGs is queried from core several times. It is
used to allocate LAG array, and then to iterate over it. In addition, it
is used for PGT initialization. To simplify the code, instead of
querying it several times, store the value as part of 'mlxsw_sp' and use
it.

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
drivers/net/ethernet/mellanox/mlxsw/spectrum.h