1. 29 Jun, 2022 34 commits
  2. 28 Jun, 2022 6 commits
    • Paolo Abeni's avatar
      Merge branch 'mlxsw-unified-bridge-conversion-part-4-6' · d521bc0a
      Paolo Abeni authored
      Ido Schimmel says:
      
      ====================
      mlxsw: Unified bridge conversion - part 4/6
      
      This is the fourth part of the conversion of mlxsw to the unified bridge
      model.
      
      Unlike previous parts that prepared mlxsw for the conversion, this part
      actually starts the conversion. It focuses on flooding configuration and
      converts mlxsw to the more "raw" APIs of the unified bridge model.
      
      The patches configure the different stages of the flooding pipeline in
      Spectrum that looks as follows (at a high-level):
      
               +------------+                +----------+           +-------+
        {FID,  |            | {Packet type,  |          |           |       |  MID
         DMAC} | FDB lookup |  Bridge type}  |   SFGC   | MID base  |       | Index
      +-------->   (miss)   +----------------> register +-----------> Adder +------->
               |            |                |          |           |       |
               |            |                |          |           |       |
               +------------+                +----+-----+           +---^---+
                                                  |                     |
                                          Table   |                     |
                                           type   |                     | Offset
                                                  |      +-------+      |
                                                  |      |       |      |
                                                  |      |       |      |
                                                  +----->+  Mux  +------+
                                                         |       |
                                                         |       |
                                                         +-^---^-+
                                                           |   |
                                                        FID|   |FID
                                                           |   |offset
                                                           +   +
      
      The multicast identifier (MID) index is used as an index to the port
      group table (PGT) that contains a bitmap of ports via which a packet
      needs to be replicated.
      
      From the PGT table, the packet continues to the multicast port egress
      (MPE) table that determines the packet's egress VLAN. This is a
      two-dimensional table that is indexed by port and switch multicast port
      to egress (SMPE) index. The latter can be thought of as a FID. Without
      it, all the packets replicated via a certain port would get the same
      VLAN, regardless of the bridge domain (FID).
      
      Logically, these two steps look as follows:
      
                           PGT table                           MPE table
                   +-----------------------+               +---------------+
                   |                       | {Local port,  |               | Egress
        MID index  | Local ports bitmap #1 |  SMPE index}  |               |  VID
      +------------>        ...            +--------------->               +-------->
                   | Local ports bitmap #N |               |               |
                   |                       |          SMPE |               |
                   +-----------------------+               +---------------+
                                                              Local port
      
      Patchset overview:
      
      Patch #1 adds a variable to guard against mixed model configuration.
      Will be removed in part 6 when mlxsw is fully converted to the unified
      model.
      
      Patches #2-#5 introduce two new FID attributes required for flooding
      configuration in the new model:
      
      1. 'flood_rsp': Instructs the firmware to handle flooding configuration
      for this FID. Only set for router FIDs (rFIDs) which are used to connect
      a {Port, VLAN} to the router block.
      
      2. 'bridge_type': Allows the device to determine the flood table (i.e.,
      base index to the PGT table) for the FID. The first type will be used
      for FIDs in a VLAN-aware bridge and the second for FIDs representing
      VLAN-unaware bridges.
      
      Patch #6 configures the MPE table that determines the egress VLAN of a
      packet that is forwarded according to L2 multicast / flood.
      
      Patches #7-#11 add the PGT table and related APIs to allocate entries
      and set / clear ports in them.
      
      Patches #12-#13 convert the flooding configuration to use the new PGT
      APIs.
      ====================
      
      Link: https://lore.kernel.org/r/20220627070621.648499-1-idosch@nvidia.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      d521bc0a
    • Amit Cohen's avatar
      mlxsw: spectrum_fid: Configure flooding entries using PGT APIs · fe94df6d
      Amit Cohen authored
      The PGT (Port Group Table) table maps an index to a bitmap of local ports
      to which a packet needs to be replicated. This table is used for layer 2
      multicast and flooding.
      
      In the legacy model, software did not interact with PGT table directly.
      Instead, it was accessed by firmware in response to registers such as SFTR
      and SMID. In the new model, the SFTR register is deprecated and software
      has full control over the PGT table using the SMID register.
      
      Use the new PGT APIs to allocate entries for flooding as part of flood
      tables initialization. Add mlxsw_sp_fid_flood_tables_fini() to free the
      allocated indexes. In addition, use PGT APIs to add/remove ports from PGT
      table. The existing code which configures the flood entries via SFTR2 will
      be removed later.
      Signed-off-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Reviewed-by: default avatarPetr Machata <petrm@nvidia.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      fe94df6d
    • Amit Cohen's avatar
      mlxsw: spectrum_fid: Set 'mid_base' as part of flood tables initialization · 9f6f467a
      Amit Cohen authored
      The PGT (Port Group Table) table maps an index to a bitmap of local ports
      to which a packet needs to be replicated. This table is used for layer 2
      multicast and flooding.
      
      The index to PGT table which is called 'mid_index', is a result of
      'mid_base' + 'fid_offset'. Using the legacy bridge model, firmware
      configures 'mid_base'. However, using the new model, software is
      responsible to configure it via SFGC register. The first 15K entries will
      be used for flooding and the rest for multicast. The table will look as
      follows:
      
      +----------------------------+
      |                            |
      | 802.1q, unicast flooding   | 4K entries
      |                            |
      +----------------------------+
      |                            |
      | 802.1q, multicast flooding | 4K entries
      |                            |
      +----------------------------+
      |                            |
      | 802.1q, broadcast flooding | 4K entries
      |                            |
      +----------------------------+
      | 802.1d, unicast flooding   | 1K entries
      +----------------------------+
      | 802.1d, multicast flooding | 1K entries
      +----------------------------+
      | 802.1d, broadcast flooding | 1K entries
      +----------------------------+
      |                            |
      |                            |
      |    Multicast entries       | The rest of the table
      |                            |
      |                            |
      +----------------------------+
      
      Add 'pgt_base' to 'struct mlxsw_sp_fid_family' and use it to calculate
      MID base, set 'SFGC.mid_base' as part of flood tables initialization.
      Signed-off-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Reviewed-by: default avatarPetr Machata <petrm@nvidia.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      9f6f467a
    • Amit Cohen's avatar
      mlxsw: spectrum: Initialize PGT table · bb1bba35
      Amit Cohen authored
      Initialize PGT table as part of mlxsw_sp_init(). This table will be used
      first in the next patch by FID code to set flooding entries, and later by
      MDB code to add multicast entries.
      Signed-off-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Reviewed-by: default avatarPetr Machata <petrm@nvidia.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      bb1bba35
    • Amit Cohen's avatar
      mlxsw: Extend PGT APIs to support maintaining list of ports per entry · a3a7992b
      Amit Cohen authored
      Add an API to associate a PGT entry with SMPE index and add or remove a
      port. This API will be used by FID code and MDB code, to add/remove port
      from specific PGT entry.
      
      When the first port is added to PGT entry, allocate the entry in the given
      MID index, when the last port is removed from PGT entry, free it.
      Signed-off-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      a3a7992b
    • Amit Cohen's avatar
      mlxsw: Add a dedicated structure for bitmap of ports · d7a7b697
      Amit Cohen authored
      Currently when bitmap of ports is needed, 'unsigned long *' type is
      used. The functions which use the bitmap assume its length according to
      its name, i.e., each function which gets a bitmap of ports queries the
      maximum number of ports and uses it as the size.
      
      As preparation for the next patch which will use bitmap of ports, add a
      dedicated structure for it. Refactor the existing code to use the new
      structure.
      Signed-off-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      d7a7b697