mlxsw: spectrum_router: Use gen_pool for RIF index allocation
authorIdo Schimmel <idosch@nvidia.com>
Wed, 7 Dec 2022 12:36:42 +0000 (13:36 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 9 Dec 2022 02:46:31 +0000 (18:46 -0800)
commit40ef76de8a7fabb30dafebae4035d3e7eebb47a9
tree0e0c1f4f9b5d6f7490bd27cf7cf1a6c3c6786923
parent837e8ac871499d337212e2161c046f5adf1bad33
mlxsw: spectrum_router: Use gen_pool for RIF index allocation

Currently, each router interface (RIF) consumes one entry in the RIFs
table and there are no alignment constraints. This is going to change in
subsequent patches where some RIFs will consume two table entries and
their indexes will need to be aligned to the allocation size (even).

Prepare for this change by converting the RIF index allocation to use
gen_pool with the 'gen_pool_first_fit_order_align' algorithm.

No Kconfig changes necessary as mlxsw already selects
'GENERIC_ALLOCATOR'.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Amit Cohen <amcohen@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.h