• A
    mlxsw: spectrum_switchdev: Implement mlxsw_sp_mc_mdb_entry_{init, fini}() · ea0f58d6
    Amit Cohen 提交于
    The next patches will convert MDB code to use PGT APIs. The change will
    move the responsibility of allocating MID indexes and writing PGT
    configurations to hardware to PGT code. As part of this change, most of the
    MDB code will be changed and improved.
    
    As a preparation for the above mentioned change, implement
    mlxsw_sp_mc_mdb_entry_{init, fini}(). Currently, there is a function
    __mlxsw_sp_mc_alloc(), which does not only allocate MID. In addition,
    there is no an equivalent function to free the MID. When
    mlxsw_sp_port_remove_from_mid() removes the last port, it handles MID
    removal. Instead, add init() and fini() functions, which use PGT APIs.
    
    The differences between the existing and the new functions are as follows:
    1. Today MDB code does not update SMID when port is added/removed while
       multicast is disabled. It maintains a bitmap of ports and once multicast
       is enabled, it writes the entry to hardware. Instead, using PGT APIs,
       the entry will be updated also when multicast is disabled, but the
       mapping between {MAC, FID}->{MID} (is configured using SFD) will be
       updated according to multicast state. It means that SMID will be updated
       all the time and disable/enable multicast will impact only SFD
       configuration.
    
    2. Today the allocation of MID index is done as part of
       mlxsw_sp_mc_write_mdb_entry(). The fact that the entry will be
       written in hardware all the time, moves the allocation of the index to
       be as part of the MDB entry initialization. PGT API is used for the
       allocation.
    
    3. Today the update of multicast router ports is done as part of
       mlxsw_sp_mc_write_mdb_entry(). Instead, add functions to add/remove
       all multicast router ports when entry is first added or removed. When
       new multicast router port will be added/removed, the dedicated API will
       be used to add/remove it from the existing entries.
    
    4. A list of ports will be stored per MDB entry instead of the exiting
       bitmap. The list will contain the multicast router ports and maintain
       reference counter per port.
    
    Add mlxsw_sp_mdb_entry_write() which is almost identical to
    mlxsw_sp_port_mdb_op(). Use more clear name and align the MID index to
    bridge model using PGT API. The existing function will be removed in the
    next patches.
    
    Note that PGT APIs configure the firmware using SMID register, like the
    driver already does today for MDB entries, so PGT APIs can be used also
    using legacy bridge model.
    Signed-off-by: NAmit Cohen <amcohen@nvidia.com>
    Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
    Signed-off-by: NDavid S. Miller <davem@davemloft.net>
    ea0f58d6
spectrum_switchdev.c 113.2 KB