• Petr Machata's avatar
    mlxsw: spectrum_pgt: Generalize PGT allocation · 8c893abd
    Petr Machata authored
    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.
    
    In this patch, change the interface accordingly. Initialize FID family's
    pgt_base from the result of the PGT allocation (note that mlxsw makes a
    copy of the family structure, so what gets initialized is not actually the
    global structure). Drop the now-unnecessary pgt_base initializations and
    the corresponding defines.
    Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
    Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    8c893abd
spectrum_pgt.c 7.79 KB