1. 04 Jul, 2022 11 commits
    • Amit Cohen's avatar
      mlxsw: Enable unified bridge model · 77b7f83d
      Amit Cohen authored
      After all the preparations for unified bridge model, finally flip mlxsw
      driver to use the new model.
      
      Change config profile, set 'ubridge' to true and remove the configurations
      that are relevant only for the legacy model. Set 'flood_mode' to
      'controlled' as the current mode is not supported with unified bridge
      model.
      
      Remove all the code which is dedicated to the legacy model. Remove
      'struct mlxsw_sp.ubridge' variable which was temporarily added to separate
      configurations between the models.
      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 avatarDavid S. Miller <davem@davemloft.net>
      77b7f83d
    • Amit Cohen's avatar
      mlxsw: Add ubridge to config profile · e9cf8990
      Amit Cohen authored
      The unified bridge model is enabled via the CONFIG_PROFILE command
      during driver initialization. Add the definition of the relevant fields
      to the command's payload in preparation for unified bridge enablement.
      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 avatarDavid S. Miller <davem@davemloft.net>
      e9cf8990
    • Amit Cohen's avatar
      mlxsw: Add support for 802.1Q FID family · bf73904f
      Amit Cohen authored
      Using the legacy bridge model, there is no VID classification at egress
      for 802.1Q FIDs, which means that the VID is maintained.
      
      This behavior cause the limitation that 802.1Q FIDs cannot work with VXLAN.
      This limitation stems from the fact that a decapsulated VXLAN packet should
      not contain a VLAN tag. If such a packet was to egress from a local port
      using a 802.1Q FID, it would "maintain" its VLAN on egress, which is no
      VLAN at all.
      
      Currently 802.1Q FIDs are emulated in mlxsw driver using 802.1D FIDs. Using
      unified bridge model, there is a FID->VID mapping, so it is possible to
      stop emulating 802.1Q FIDs.
      
      The main changes are:
      1. Use 'SFGC.bridge_type' = 0, to separate between 802.1Q FIDs and
         802.1D FIDs.
      2. Use VLAN RIF instead of the emulated one (VLAN_EMU which is emulated
         using FID RIF).
      3. Create VID->FID mapping when the FID is created. Then when a new port
         is mapped to the FID, if it not in virtual mode, no new mapping is
         needed. Save the new port in 'port_vid_list', to be able to update a
         RIF in all {Port, VID}->FID mappings in case that the port will be in
         virtual mode later.
      4. Add a dedicated operation function per FID family to update RIF for
         VID->FID mappings. For 802.1d and rFID families, just return. For
         802.1q family, handle the global mapping which is created for new 802.1q
         FID.
      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 avatarDavid S. Miller <davem@davemloft.net>
      bf73904f
    • Amit Cohen's avatar
      mlxsw: Add new FID families for unified bridge model · d4324e31
      Amit Cohen authored
      In the unified bridge model, mlxsw will no longer emulate 802.1Q FIDs
      using 802.1D FIDs. The new FID table will look as follows:
      
           +---------------+
           | 802.1q FIDs   | 4K entries
           | [1..4094]     |
           +---------------+
           | 802.1d FIDs   | 1K entries
           | [4095..5118]  |
           +---------------+
           | Dummy FIDs    | 1 entry
           | [5119..5119]  |
           +---------------+
           | rFIDs         | 11K entries
           | [5120..16383] |
           +---------------+
      
      In order to make the change easier to review, four new temporary FID
      families will be added (e.g., MLXSW_SP_FID_TYPE_8021D_UB) and will not
      be registered with the FID core until mlxsw is flipped to use the unified
      bridge model.
      
      Add .1d, rfid and dummy FID families for unified bridge, the next patch
      will add .1q family separately as it requires more changes.
      
      The following changes are required:
      1. Add 'smpe_index_valid' field to 'struct mlxsw_sp_fid_family' and set
         SFMR.smpe accordingly. SMPE index is reserved for rFIDs, as their
         flooding is handled by firmware, and always reserved in Spectrum-1,
         as it is configured as part of PGT table.
      
      2. Add 'ubridge' field to 'struct mlxsw_sp_fid_family'. This field will
         be removed later, use it in mlxsw_sp_fid_family_{register,unregister}()
         to skip the registration / unregistration of the new families when the
         legacy model is used.
      
      3. Indexes - the start and end indexes of each FID family will need to be
         changed according to the above diagram.
      
      4. Add flood tables for unified bridge model, use 'fid_offset' as table
         type, as in the new model the access to flood tables will be using
         'fid_offset' calculation.
      
      5. FID family operation changes:
         a. rFID supposed to be created using SFMR, as it is not created by
            firmware using unified bridge model.
         b. port_vid_map() should perform SVFA for rFID, as the mapping is not
            created by firmware using unified bridge model.
         c. flood_index() is not aligned to the new model, as this function 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 avatarDavid S. Miller <davem@davemloft.net>
      d4324e31
    • Amit Cohen's avatar
      mlxsw: Add support for VLAN RIFs · 662761d8
      Amit Cohen authored
      Router interfaces (RIFs) constructed on top of VLAN-aware bridges are of
      'VLAN' type, whereas RIFs constructed on top of VLAN-unaware bridges are of
      'FID' type.
      
      Currently 802.1Q FIDs are emulated using 802.1D FIDs, therefore VLAN RIFs
      are emulated using FID RIFs. As part of converting the driver to use
      unified bridge model, 802.1Q FIDs and VLAN RIFs will be used.
      
      The egress FID is required for VLAN RIFs in Spectrum-2 and above, but not
      in Spectrum-1, as in Spectrum-1 the mapping for VLAN RIFs is VID->FID,
      while in other ASICs it is FID->FID. The reason for the change is that it
      is more scalable to reuse the FID->FID entry than creating multiple
      {Port, VID}->FID entries for the router port. Use the existing operation
      structure to separate the configuration between different ASICs.
      
      Add support for VLAN RIFs, most of the configurations are same to FID
      RIFs.
      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 avatarDavid S. Miller <davem@davemloft.net>
      662761d8
    • Amit Cohen's avatar
      mlxsw: Configure egress FID classification after routing · 058de325
      Amit Cohen authored
      After routing, a packet needs to perform an L2 lookup using the DMAC it got
      from the routing and a FID. In unified bridge model, the egress FID
      configuration needs to be performed by software.
      
      It is configured by RITR for both sub-port RIFs and FID RIFs. Currently
      FID RIFs already configure eFID. Add eFID configuration for sub-port RIFs.
      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 avatarDavid S. Miller <davem@davemloft.net>
      058de325
    • Amit Cohen's avatar
      mlxsw: spectrum_router: Do not configure VID for sub-port RIFs · 2c3ae763
      Amit Cohen authored
      The field 'vid' in RITR is reserved when unified bridge model is used
      and the RIF's type is sub-port RIF. Instead, ingress VID is configured via
      SVFA and egress VID is configured via REIV.
      
      Set 'vid' to zero in RITR register for sub-port RIF when unified bridge
      model is used.
      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 avatarDavid S. Miller <davem@davemloft.net>
      2c3ae763
    • Amit Cohen's avatar
      mlxsw: spectrum_fid: Configure layer 3 egress VID classification · d4b464d2
      Amit Cohen authored
      After routing, the device always consults a table that determines the
      packet's egress VID based on {egress RIF, egress local port}. In the
      unified bridge model, it is up to software to maintain this table via REIV
      register.
      
      The table needs to be updated in the following flows:
      1. When a RIF is set on a FID, need to iterate over the FID's {Port, VID}
         list and issue REIV write to map the {RIF, Port} to the given VID.
      2. When a {Port, VID} is mapped to a FID and the FID already has a RIF,
         need to issue REIV write with a single record to map the {RIF, Port}
         to the given VID.
      
      REIV register supports a simultaneous update of 256 ports, so use this
      capability for the first flow.
      
      Handle the two above mentioned flows.
      
      Add mlxsw_sp_fid_evid_map() function to handle egress VID classification
      for both unicast and multicast. Layer 2 multicast configuration is already
      done in the driver, just move it to the new function.
      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 avatarDavid S. Miller <davem@davemloft.net>
      d4b464d2
    • Amit Cohen's avatar
      mlxsw: Configure ingress RIF classification · fea20547
      Amit Cohen authored
      Before layer 2 forwarding, the device classifies an incoming packet to
      a FID. The classification is done based on one of the following keys:
      
      1. FID
      2. VNI (after decapsulation)
      3. VID / {Port, VID}
      
      After classification, the FID is known, but also all the attributes of
      the FID, such as the router interface (RIF) via which a packet that
      needs to be routed will ingress the router block.
      
      In the legacy model, when a RIF was created / destroyed, it was
      firmware's responsibility to update it in the previously mentioned FID
      classification records. In the unified bridge model, this responsibility
      moved to software.
      
      The third classification requires to iterate over the FID's {Port, VID}
      list and issue SVFA write with the correct mapping table according to the
      port's mode (virtual or not). We never map multiple VLANs to the same FID
      using VID->FID mapping, so such a mapping needs to be performed once.
      
      When a new FID classification entry is configured and the FID already has
      a RIF, set the RIF as part of SVFA configuration.
      
      The reverse needs to be done when clearing a RIF from a FID. Currently,
      clearing is done by issuing mlxsw_sp_fid_rif_set() with a NULL RIF pointer.
      Instead, introduce mlxsw_sp_fid_rif_unset().
      
      Note that mlxsw_sp_fid_rif_set() is called after the RIF is fully
      operational, so it conforms to the internal requirement regarding
      SVFA.irif_v: "Must not be set for a non-enabled RIF".
      
      Do not set the ingress RIF for rFIDs, as the {Port, VID}->rFID entry is
      configured by firmware when legacy model is used, a next patch will
      handle this configuration for rFIDs and unified bridge model.
      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 avatarDavid S. Miller <davem@davemloft.net>
      fea20547
    • Amit Cohen's avatar
      mlxsw: spectrum_fid: Configure VNI to FID classification · 8cfc7f77
      Amit Cohen authored
      In the new model, SFMR no longer configures both VNI->FID and FID->VNI
      classifications, but only the later. The former needs to be configured via
      SVFA.
      
      Add SVFA configuration as part of vni_set() and vni_clear().
      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 avatarDavid S. Miller <davem@davemloft.net>
      8cfc7f77
    • Amit Cohen's avatar
      mlxsw: Configure egress VID for unicast FDB entries · 53d7ae53
      Amit Cohen authored
      Using unified bridge model, firmware no longer configures the egress VID
      "under the hood" and moves this responsibility to software.
      
      For layer 2, this means that software needs to determine the egress VID
      for both unicast (i.e., FDB) and multicast (i.e., MDB and flooding) flows.
      
      Unicast FDB records and unicast LAG FDB records have new fields - "set_vid"
      and "vid", set them. For records which point to router port, do not set
      these fields.
      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 avatarDavid S. Miller <davem@davemloft.net>
      53d7ae53
  2. 03 Jul, 2022 16 commits
  3. 02 Jul, 2022 13 commits