• Amit Cohen's avatar
    mlxsw: spectrum_switchdev: Convert MDB code to use PGT APIs · e28cd993
    Amit Cohen authored
    The previous patches added common APIs for maintaining PGT (Port Group
    Table) table. In the legacy model, software did not interact with this
    table directly. Instead, it was accessed by firmware in response to
    registers such as SFTR and SMID. In the new model, software has full
    control over the PGT table using the SMID register.
    
    The configuration of MDB entries is already done via SMID, so the new
    PGT APIs can be used also using the legacy model, the only difference is
    that MID index should be aligned to bridge model. See a previous patch
    which added API for that.
    
    The main changes are:
    - MDB code does not maintain bitmap of ports in MDB entry anymore, instead,
      it stores a list of ports with additional information.
    - MDB code does not configure SMID register directly anymore, it will be
      done via PGT API when port is first added or removed.
    - Today MDB code does not update SMID when port is added/removed while
      multicast is disabled. Instead, it maintains bitmap of ports and once
      multicast is enabled, it rewrite the entry to hardware. Using PGT APIs,
      the entry will be updated also when multicast is disabled, but the
      mapping between {MAC, FID}->{MID} will not appear in SFD register. It
      means that SMID will be updated all the time and disable/enable multicast
      will impact only SFD configuration.
    - For multicast router, today only SMID is updated and the bitmap is not
      updated. Using the new list of ports, there is a reference count for each
      port, so it can be saved in software also. For such port,
      'struct mlxsw_sp_mdb_entry.ports_count' will not be updated and the
      port in the list will be marked as 'mrouter'.
    - Finally, `struct mlxsw_sp_mid.in_hw` is not needed anymore.
    Signed-off-by: default avatarAmit Cohen <amcohen@nvidia.com>
    Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    e28cd993
spectrum_switchdev.c 109 KB