mlxsw: spectrum_fid: Allocate PGT for the whole FID family in one go
authorPetr Machata <petrm@nvidia.com>
Thu, 19 Oct 2023 10:27:17 +0000 (12:27 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 20 Oct 2023 10:47:50 +0000 (11:47 +0100)
commitf5e293f9939e6cb532efa19c0043f8b93355c88b
tree32f52a35f545363e30deb728c8320aaa47e8e42a
parentdaee7aaba8491e64911438696c5f3f7cb77edf5e
mlxsw: spectrum_fid: Allocate PGT for the whole FID family in one go

PGT blocks are allocated through the function
mlxsw_sp_pgt_mid_alloc_range(). The interface assumes that the caller knows
which piece of PGT exactly they want to get. That was fine while the FID
code was the only client allocating blocks of PGT. However for SW-allocated
LAG table, there will be an additional client: mlxsw_sp_lag_init(). The
interface should therefore be changed to not require particular
coordinates, but to take just the requested size, allocate the block
wherever, and give back the PGT address.

The current FID mode has one place where PGT address can be stored: the FID
family's pgt_base. The allocation scheme should therefore be changed from
allocating a block per FID flood table, to allocating a block per FID
family.

Do just that in this patch.

The per-family allocation is going to be useful for another related feature
as well: the CFF mode.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c