1. Jun 25, 2023
  2. Jun 24, 2023
    • Jakub Kicinski's avatar
      Merge branch 'mlxsw-maintain-candidate-rifs' · d1d29a42
      Jakub Kicinski authored
      Petr Machata says:
      
      ====================
      mlxsw: Maintain candidate RIFs
      
      The mlxsw driver currently makes the assumption that the user applies
      configuration in a bottom-up manner. Thus netdevices need to be added to
      the bridge before IP addresses are configured on that bridge or SVI added
      on top of it. Enslaving a netdevice to another netdevice that already has
      uppers is in fact forbidden by mlxsw for this reason. Despite this safety,
      it is rather easy to get into situations where the offloaded configuration
      is just plain wrong.
      
      As an example, take a front panel port, configure an IP address: it gets a
      RIF. Now enslave the port to the bridge, and the RIF is gone. Remove the
      port from the bridge again, but the RIF never comes back. There is a number
      of similar situations, where changing the configuration there and back
      utterly breaks the offload.
      
      The situation is going to be made better by implementing a range of replays
      and post-hoc offloads.
      
      This patch set lays the ground for replay of next hops. The particular
      issue that it deals with is that currently, driver-specific bookkeeping for
      next hops is hooked off RIF objects, which come and go across the lifetime
      of a netdevice. We would rather keep these objects at an entity that
      mirrors the lifetime of the netdevice itself. That way they are at hand and
      can be offloaded when a RIF is eventually created.
      
      To that end, with this patchset, mlxsw keeps a hash table of CRIFs:
      candidate RIFs, persistent handles for netdevices that mlxsw deems
      potentially interesting. The lifetime of a CRIF matches that of the
      underlying netdevice, and thus a RIF can always assume a CRIF exists. A
      CRIF is where next hops are kept, and when RIF is created, these next hops
      can be easily offloaded. (Previously only the next hops created after the
      RIF was created were offloaded.)
      
      - Patches #1 and #2 are minor adjustments.
      - In patches #3 and #4, add CRIF bookkeeping.
      - In patch #5, link CRIFs to RIFs such that given a netdevice-backed RIF,
        the corresponding CRIF is easy to look up.
      - Patch #6 is a clean-up allowed by the previous patches
      - Patches #7 and #8 move next hop tracking to CRIFs
      
      No observable effects are intended as of yet. This will be useful once
      there is support for RIF creation for netdevices that become mlxsw uppers,
      which will come in following patch sets.
      ====================
      
      Link: https://lore.kernel.org/r/cover.1687438411.git.petrm@nvidia.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      d1d29a42
    • Petr Machata's avatar
      mlxsw: spectrum_router: Track next hops at CRIFs · 9464a3d6
      Petr Machata authored
      
      
      Move the list of next hops from struct mlxsw_sp_rif to mlxsw_sp_crif. The
      reason is that eventually, next hops for mlxsw uppers should be offloaded
      and unoffloaded on demand as a netdevice becomes an upper, or stops being
      one. Currently, next hops are tracked at RIFs, but RIFs do not exist when a
      netdevice is not an mlxsw uppers. CRIFs are kept track of throughout the
      netdevice lifetime.
      
      Correspondingly, track at each next hop not its RIF, but its CRIF (from
      which a RIF can always be deduced).
      
      Note that now that next hops are tracked at a CRIF, it is not necessary to
      move each over to a new RIF when it is necessary to edit a RIF. Therefore
      drop mlxsw_sp_nexthop_rif_migrate() and have mlxsw_sp_rif_migrate_destroy()
      call mlxsw_sp_nexthop_rif_update() directly.
      
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarDanielle Ratson <danieller@nvidia.com>
      Link: https://lore.kernel.org/r/e7c1c0a7dd13883b0f09aeda12c4fcf4d63a70e3.1687438411.git.petrm@nvidia.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9464a3d6