Skip to content
  1. Nov 22, 2023
    • Michael Chan's avatar
      bnxt_en: Modify TX ring indexing logic. · 6d1add95
      Michael Chan authored
      
      
      Change the TX ring logic so that the index increments unbounded and
      mask it only when needed.
      
      Modify the existing macros so that the index is not masked.  Add a
      new macro RING_TX() to mask it only when needed to get the index of
      txr->tx_buf_ring[].
      
      Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Link: https://lore.kernel.org/r/20231120234405.194542-11-michael.chan@broadcom.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      6d1add95
    • Michael Chan's avatar
      bnxt_en: Add db_ring_mask and related macro to bnxt_db_info struct. · b9e0c47e
      Michael Chan authored
      
      
      This allows the doorbell related logic to mask the doorbell index
      to the proper range before writing the doorbell.
      
      The current code masks the doorbell index immediately to keep it in the
      legal ranges for the most part.  Subsequent patches will change the
      logic so that the index increments unbounded and it only gets masked
      before use.  This is preparation work for the new chip that requires an
      additional Epoch bit in the doorbell that needs to toggle when the index
      has wrapped around.
      
      This patch just adds the basic infrastructure and the logic is largely
      unchanged.  We now replace RING_CMP() with the new DB_RING_IDX() at
      appropriate places where we mask the completion ring index before
      writing the doorbell.
      
      Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Link: https://lore.kernel.org/r/20231120234405.194542-10-michael.chan@broadcom.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b9e0c47e
    • Michael Chan's avatar
      bnxt_en: Add support for HWRM_FUNC_BACKING_STORE_CFG_V2 firmware calls · 236e237f
      Michael Chan authored
      
      
      Newer chips starting with 57600 will use this new firmware HWRM call to
      configure backing store memory.  Add this new call if it is supported
      by the firmware.
      
      Reviewed-by: default avatarHongguang Gao <hongguang.gao@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Link: https://lore.kernel.org/r/20231120234405.194542-9-michael.chan@broadcom.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      236e237f
    • Michael Chan's avatar
      bnxt_en: Add support for new backing store query firmware API · 6a4d0774
      Michael Chan authored
      
      
      Use the new v2 firmware API if supported by the firmware.  We now have the
      infrastructure to support the v2 API.
      
      Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Link: https://lore.kernel.org/r/20231120234405.194542-8-michael.chan@broadcom.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      6a4d0774
    • Michael Chan's avatar
      bnxt_en: Add bnxt_setup_ctxm_pg_tbls() helper function · b098dc5a
      Michael Chan authored
      
      
      In bnxt_alloc_ctx_mem(), the logic to set up the context memory entries
      and to allocate the context memory tables is done repetitively.  Add
      a helper function to simplify the code.
      
      The setup of the Fast Path TQM entries relies on some information from
      the Slow Path TQM entries.  Copy the SP_TQM entries to the FP_TQM
      entries to simplify the logic.
      
      Reviewed-by: default avatarAndy Gospodarek <andrew.gospodarek@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Link: https://lore.kernel.org/r/20231120234405.194542-7-michael.chan@broadcom.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b098dc5a
    • Michael Chan's avatar
      bnxt_en: Use the pg_info field in bnxt_ctx_mem_type struct · 2ad67aea
      Michael Chan authored
      
      
      Use the newly added pg_info field in bnxt_ctx_mem_type struct and
      remove the standalone page info structures in bnxt_ctx_mem_info.
      This now completes the reorganization of the context memory
      structures to work better with the new and more flexible firmware
      interface for newer chips.
      
      Reviewed-by: default avatarSomnath Kotur <somnath.kotur@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Link: https://lore.kernel.org/r/20231120234405.194542-6-michael.chan@broadcom.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2ad67aea
    • Michael Chan's avatar
      bnxt_en: Add page info to struct bnxt_ctx_mem_type · 035c5761
      Michael Chan authored
      
      
      This will further improve the organization of the bnxt_ctx_mem_info
      structure by moving the standalone page info structures into the
      bnxt_ctx_mem_type array.  Add the allocation and free logic first and
      the next patch will migrate to use the new infrastructure.
      
      Reviewed-by: default avatarSomnath Kotur <somnath.kotur@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Link: https://lore.kernel.org/r/20231120234405.194542-5-michael.chan@broadcom.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      035c5761
    • Michael Chan's avatar
      bnxt_en: Restructure context memory data structures · 76087d99
      Michael Chan authored
      
      
      The current code uses a flat bnxt_ctx_mem_info structure to store 8
      types of context memory for the NIC.  All the context memory types
      are very similar and have similar parameters.  They can all share a
      common structure to improve the organization.  Also, new firmware
      interface will provide a new API to retrieve each type of context
      memory by calling the API repeatedly.
      
      This patch reorganizes the bnxt_ctx_mem_info structure to fit better
      with the new firmware interface.  It will also work with the legacy
      firmware interface.  The flat fields in bnxt_ctx_mem_info are replaced
      by the bnxt_ctx_mem_type array.  The bnxt_mem_init array info will no
      longer be needed.
      
      Reviewed-by: default avatarSomnath Kotur <somnath.kotur@broadcom.com>
      Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Link: https://lore.kernel.org/r/20231120234405.194542-4-michael.chan@broadcom.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      76087d99
    • Michael Chan's avatar
      bnxt_en: Free bp->ctx inside bnxt_free_ctx_mem() · e50dc4c2
      Michael Chan authored
      
      
      We always free bp->ctx right after calling bnxt_free_ctx_mem(), so just
      free it at the end of that function to make things simpler.
      
      Reviewed-by: default avatarSomnath Kotur <somnath.kotur@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Link: https://lore.kernel.org/r/20231120234405.194542-3-michael.chan@broadcom.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e50dc4c2
    • Michael Chan's avatar
      bnxt_en: The caller of bnxt_alloc_ctx_mem() should always free bp->ctx · aa8460ba
      Michael Chan authored
      
      
      bnxt_alloc_ctx_mem() calls bnxt_hwrm_func_backing_store_qcaps() to
      allocate the memory for bp->ctx.  Initialize bp->ctx with the allocated
      memory and let the caller free it during unwind.  The unwind logic is
      already there, we just need to always set bp->ctx to the allocated
      memory so the caller will always free it.  This simplifies the logic
      and makes it easier to expand on the backing store logic.
      
      Reviewed-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
      Reviewed-by: default avatarSomnath Kotur <somnath.kotur@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Link: https://lore.kernel.org/r/20231120234405.194542-2-michael.chan@broadcom.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      aa8460ba
    • Jakub Kicinski's avatar
      Merge branch 'net-page_pool-add-netlink-based-introspection-part1' · 46e208e7
      Jakub Kicinski authored
      
      
      Jakub Kicinski says:
      
      ====================
      net: page_pool: plit the page_pool_params into fast and slow
      
      Small refactoring in prep for adding more page pool params
      which won't be needed on the fast path.
      
      v1:  https://lore.kernel.org/all/20231024160220.3973311-1-kuba@kernel.org/
      RFC: https://lore.kernel.org/all/20230816234303.3786178-1-kuba@kernel.org/
      ====================
      
      Link: https://lore.kernel.org/r/20231121000048.789613-1-kuba@kernel.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      46e208e7
    • Jakub Kicinski's avatar
      net: page_pool: avoid touching slow on the fastpath · 2da0cac1
      Jakub Kicinski authored
      
      
      To fully benefit from previous commit add one byte of state
      in the first cache line recording if we need to look at
      the slow part.
      
      The packing isn't all that impressive right now, we create
      a 7B hole. I'm expecting Olek's rework will reshuffle this,
      anyway.
      
      Acked-by: default avatarJesper Dangaard Brouer <hawk@kernel.org>
      Reviewed-by: default avatarIlias Apalodimas <ilias.apalodimas@linaro.org>
      Reviewed-by: default avatarMina Almasry <almasrymina@google.com>
      Link: https://lore.kernel.org/r/20231121000048.789613-3-kuba@kernel.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2da0cac1
    • Jakub Kicinski's avatar
      net: page_pool: split the page_pool_params into fast and slow · 5027ec19
      Jakub Kicinski authored
      
      
      struct page_pool is rather performance critical and we use
      16B of the first cache line to store 2 pointers used only
      by test code. Future patches will add more informational
      (non-fast path) attributes.
      
      It's convenient for the user of the API to not have to worry
      which fields are fast and which are slow path. Use struct
      groups to split the params into the two categories internally.
      
      Acked-by: default avatarJesper Dangaard Brouer <hawk@kernel.org>
      Reviewed-by: default avatarMina Almasry <almasrymina@google.com>
      Reviewed-by: default avatarIlias Apalodimas <ilias.apalodimas@linaro.org>
      Link: https://lore.kernel.org/r/20231121000048.789613-2-kuba@kernel.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      5027ec19
    • Jakub Kicinski's avatar
      Merge branch 'mlxsw-preparations-for-support-of-cff-flood-mode' · 3a17ea77
      Jakub Kicinski authored
      
      
      Petr Machata says:
      
      ====================
      mlxsw: Preparations for support of CFF flood mode
      
      PGT is an in-HW table that maps addresses to sets of ports. Then when some
      HW process needs a set of ports as an argument, instead of embedding the
      actual set in the dynamic configuration, what gets configured is the
      address referencing the set. The HW then works with the appropriate PGT
      entry.
      
      Among other allocations, the PGT currently contains two large blocks for
      bridge flooding: one for 802.1q and one for 802.1d. Within each of these
      blocks are three tables, for unknown-unicast, multicast and broadcast
      flooding:
      
            . . . |    802.1q    |    802.1d    | . . .
                  | UC | MC | BC | UC | MC | BC |
                   \______ _____/ \_____ ______/
                          v             v
                         FID flood vectors
      
      Thus each FID (which corresponds to an 802.1d bridge or one VLAN in an
      802.1q bridge) uses three flood vectors spread across a fairly large region
      of PGT.
      
      This way of organizing the flood table (called "controlled") is not very
      flexible. E.g. to decrease a bridge scale and store more IP MC vectors, one
      would need to completely rewrite the bridge PGT blocks, or resort to hacks
      such as storing individual MC flood vectors into unused part of the bridge
      table.
      
      In order to address these shortcomings, Spectrum-2 and above support what
      is called CFF flood mode, for Compressed FID Flooding. In CFF flood mode,
      each FID has a little table of its own, with three entries adjacent to each
      other, one for unknown-UC, one for MC, one for BC. This allows for a much
      more fine-grained approach to PGT management, where bits of it are
      allocated on demand.
      
            . . . | FID | FID | FID | FID | FID | . . .
                  |U|M|B|U|M|B|U|M|B|U|M|B|U|M|B|
                   \_____________ _____________/
                                 v
                         FID flood vectors
      
      Besides the FID table organization, the CFF flood mode also impacts Router
      Subport (RSP) table. This table contains flood vectors for rFIDs, which are
      FIDs that reference front panel ports or LAGs. The RSP table contains two
      entries per front panel port and LAG, one for unknown-UC traffic, and one
      for everything else. Currently, the FW allocates and manages the table in
      its own part of PGT. rFIDs are marked with flood_rsp bit and managed
      specially. In CFF mode, rFIDs are managed as all other FIDs. The driver
      therefore has to allocate and maintain the flood vectors. Like with bridge
      FIDs, this is more work, but increases flexibility of the system.
      
      The FW currently supports both the controlled and CFF flood modes. To shed
      complexity, in the future it should only support CFF flood mode. Hence this
      patchset, which is the first in series of two to add CFF flood mode support
      to mlxsw.
      
      There are FW versions out there that do not support CFF flood mode, and on
      Spectrum-1 in particular, there is no plan to support it at all. mlxsw will
      therefore have to support both controlled flood mode as well as CFF.
      
      Another aspect is that at least on Spectrum-1, there are FW versions out
      there that claim to support CFF flood mode, but then reject or ignore
      configurations enabling the same. The driver thus has to have a say in
      whether an attempt to configure CFF flood mode should even be made.
      
      Much like with the LAG mode, the feature is therefore expressed in terms of
      "does the driver prefer CFF flood mode?", and "what flood mode the PCI
      module managed to configure the FW with". This gives to the driver a chance
      to determine whether CFF flood mode configuration should be attempted.
      
      In this patchset, we lay the ground with new definitions, registers and
      their fields, and some minor code shaping. The next patchset will be more
      focused on introducing necessary abstractions and implementation.
      
      - Patches #1 and #2 add CFF-related items to the command interface.
      
      - Patch #3 adds a new resource, for maximum number of flood profiles
        supported. (A flood profile is a mapping between traffic type and offset
        in the per-FID flood vector table.)
      
      - Patches #4 to #8 adjust reg.h. The SFFP register is added, which is used
        for configuring the abovementioned traffic-type-to-offset mapping. The
        SFMR, register, which serves for FID configuration, is extended with
        fields specific to CFF mode. And other minor adjustments.
      
      - Patches #9 and #10 add the plumbing for CFF mode: a way to request that
        CFF flood mode be configured, and a way to query the flood mode that was
        actually configured.
      
      - Patch #11 removes dead code.
      
      - Patches #12 and #13 add helpers that the next patchset will make use of.
        Patch #14 moves RIF setup ahead so that FID code can make use of it.
      ====================
      
      Link: https://lore.kernel.org/r/cover.1700503643.git.petrm@nvidia.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      3a17ea77
    • Petr Machata's avatar
      mlxsw: spectrum_router: Call RIF setup before obtaining FID · f7ebb402
      Petr Machata authored
      
      
      For subport RIFs, the setup initializes, among other things, RIF port and
      LAG numbers. Those are important to determine where in the PGT the RIF FID
      will be stored. Therefore, call the RIF setup before fid_get.
      
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Link: https://lore.kernel.org/r/f24d8cad7e4748b8e8e0e16894ca6a20704dea32.1700503644.git.petrm@nvidia.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f7ebb402
    • Petr Machata's avatar
      mlxsw: spectrum_router: Add a helper to get subport number from a RIF · 27851dfa
      Petr Machata authored
      
      
      In the CFF flood mode, responsibility for management of the PGT entries for
      rFIDs is moved from FW to the driver. All rFIDs are based off either a
      front panel port, or a LAG port. The flood vectors for port-based rFIDs
      enable just the port itself, the ones for LAG-based rFIDs enable all member
      ports of the LAG in question.
      
      Since all rFIDs based off the same port have the same flood vector, and
      similarly for LAG-based rFIDs, the flood entries are shared. The PGT
      address of the flood vector is therefore determined based on the port (or
      LAG) number of the RIF connected with the rFID.
      
      Add a helper to determine subport number given a RIF, to be used in these
      calculations.
      
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Link: https://lore.kernel.org/r/d7ab43cf5b021f785f363f236e4b6780d10eea93.1700503644.git.petrm@nvidia.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      27851dfa
    • Petr Machata's avatar
      mlxsw: spectrum_fid: Extract SFMR packing into a helper · 2b7bccd1
      Petr Machata authored
      
      
      Both mlxsw_sp_fid_op() and mlxsw_sp_fid_edit_op() pack the core of SFMR the
      same way. Extract the common code into a helper and call that. Extract out
      of that a wrapper that just calls mlxsw_reg_sfmr_pack(), because it will
      be useful for the dummy family later on.
      
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Link: https://lore.kernel.org/r/31f32b4d767183f6cb197148d0792feab2efadba.1700503644.git.petrm@nvidia.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2b7bccd1
    • Petr Machata's avatar
      mlxsw: spectrum_fid: Drop unnecessary conditions · b51c876c
      Petr Machata authored
      
      
      The caller already only calls mlxsw_sp_fid_flood_tables_init() and
      mlxsw_sp_fid_flood_tables_fini() if (fid_family->flood_tables). There
      is no configuration where the pointer is non-NULL, but the number of
      tables is zero. So drop the conditions.
      
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Link: https://lore.kernel.org/r/897c6841bc756ac632b797bf67ac83c6a66ba359.1700503644.git.petrm@nvidia.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b51c876c
    • Petr Machata's avatar
      mlxsw: pci: Permit enabling CFF mode · 9aad19a3
      Petr Machata authored
      
      
      There are FW versions out there that do not support CFF flood mode, and on
      Spectrum-1 in particular, there is no plan to support it at all. mlxsw will
      therefore have to support both controlled flood mode as well as CFF. There
      are also FW versions out there that claim to support CFF flood mode, but
      then reject or ignore configurations enabling the same. The driver thus has
      to have a say in whether an attempt to configure CFF flood mode should even
      be made, and what to use as a fallback.
      
      Hence express the feature in terms of "does the driver prefer CFF flood
      mode?", and "what flood mode the PCI module managed to configure the FW
      with". This gives to the driver a chance to determine whether CFF flood
      mode configuration should be attempted.
      
      The latter bit was added in previous patches. In this patch, add the bit
      that allows the driver to determine whether CFF enablement should be
      attempted, and the enablement code itself.
      
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Link: https://lore.kernel.org/r/41640a0ee58e0a9538f820f7b601a0e35f6449e4.1700503644.git.petrm@nvidia.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9aad19a3
    • Petr Machata's avatar
      mlxsw: core, pci: Add plumbing related to CFF mode · 09591595
      Petr Machata authored
      
      
      CFF mode, for Compressed FID Flooding, is a way of organizing flood vectors
      in the PGT table. The bus module determines whether CFF is supported, can
      configure flood mode to CFF if it is, and knows what flood mode has been
      configured. Therefore add a bus callback to determine the configured flood
      mode. Also add to core an API to query it.
      
      Since after this patch, we rely on mlxsw_pci->flood_mode being set, it
      becomes a coding error if a driver invokes this function with a set of
      fields that misses the initialization. Warn and bail out in that case.
      
      The CFF mode is not used as of this patch. The code to actually use it will
      be added later.
      
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Link: https://lore.kernel.org/r/889d58759dd40f5037f2206b9fc4a78a9240da80.1700503644.git.petrm@nvidia.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      09591595
    • Petr Machata's avatar
      mlxsw: reg: Add to SFMR register the fields related to CFF flood mode · 6b10371c
      Petr Machata authored
      
      
      Add the field cff_mid_base, which specifies at which point in PGT the
      per-FID flood table is stored. Add cff_prf_id, the profile ID, which
      determines on which row of the flood table a flood vector can be found for
      a given traffic type.
      
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Link: https://lore.kernel.org/r/3ad7ae38cf6534bedcd876f16090d109a814b3e3.1700503644.git.petrm@nvidia.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      6b10371c
    • Petr Machata's avatar
      mlxsw: reg: Extract flood-mode specific part of mlxsw_reg_sfmr_pack() · 446bc1e9
      Petr Machata authored
      
      
      In CFF mode, it is necessary to set a different set of SFMR fields. Leave
      in mlxsw_reg_sfmr_pack() only the common bits, and move the parts relevant
      to controlled flood mode directly to the call site.
      
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Link: https://lore.kernel.org/r/6f29639ebc3ca0722272e6c644ca910096469413.1700503644.git.petrm@nvidia.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      446bc1e9
    • Petr Machata's avatar
      mlxsw: reg: Drop unnecessary writes from mlxsw_reg_sfmr_pack() · 642d6a20
      Petr Machata authored
      
      
      The MLXSW_REG_ZERO at the beginning of the function wipes the whole
      payload. There's no need to set vtfp and vv to false explicitly.
      
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Link: https://lore.kernel.org/r/04a51ea7cf31eea0ef7707311d8e864e2d9ef307.1700503644.git.petrm@nvidia.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      642d6a20
    • Petr Machata's avatar
      mlxsw: reg: Mark SFGC & some SFMR fields as reserved in CFF mode · 7eb90295
      Petr Machata authored
      
      
      Some existing fields and the whole register of SFGC are reserved in CFF
      mode. Backport the reservation note to these fields.
      
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Link: https://lore.kernel.org/r/e1d5977a8cb778227e4ea2fd1515529957ce5de7.1700503643.git.petrm@nvidia.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7eb90295
    • Petr Machata's avatar
      mlxsw: reg: Add Switch FID Flooding Profiles Register · e1e4ce6c
      Petr Machata authored
      
      
      The SFFP register populates the fid flooding profile tables used for the
      NVE flooding and Compressed-FID Flooding (CFF).
      
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Link: https://lore.kernel.org/r/ca42eb67763bd0c7cf035afc62ef73632f3f61a6.1700503643.git.petrm@nvidia.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e1e4ce6c
    • Petr Machata's avatar
      mlxsw: resources: Add max_cap_nve_flood_prf · 2d19da92
      Petr Machata authored
      
      
      max_cap_nve_flood_prf describes maximum number of NVE flooding profiles.
      The same value then applies for flooding profiles for flooding in CFF mode.
      
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Link: https://lore.kernel.org/r/064a2e013d879e5f5494167a6c120c4bb85a2204.1700503643.git.petrm@nvidia.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2d19da92
    • Petr Machata's avatar
      mlxsw: cmd: Add MLXSW_CMD_MBOX_CONFIG_PROFILE_FLOOD_MODE_CFF · 50ee6778
      Petr Machata authored
      
      
      PGT, a port-group table is an in-HW block of specialized memory that holds
      sets of ports. Allocated within the PGT are series of flood tables that
      describe to which ports traffic of various types (unknown UC, BC, MC)
      should be flooded from which FID. The hitherto-used layout of these flood
      tables is being replaced with a more flexible scheme, called compressed FID
      flooding (CFF). CFF can be configured through CONFIG_PROFILE.flood_mode.
      
      In this patch, add MLXSW_CMD_MBOX_CONFIG_PROFILE_FLOOD_MODE_CFF, the value
      to use to enable the CFF mode.
      
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Link: https://lore.kernel.org/r/fc2e063742856492f8f22b0b87abf431ea6d53d0.1700503643.git.petrm@nvidia.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      50ee6778
    • Petr Machata's avatar
      mlxsw: cmd: Add cmd_mbox.query_fw.cff_support · 8405d662
      Petr Machata authored
      
      
      PGT, a port-group table is an in-HW block of specialized memory that holds
      sets of ports. Allocated within the PGT are series of flood tables that
      describe to which ports traffic of various types (unknown UC, BC, MC)
      should be flooded from which FID. The hitherto-used layout of these flood
      tables is being replaced with a more flexible scheme, called compressed FID
      flooding (CFF). CFF can be configured through CONFIG_PROFILE.flood_mode.
      
      cff_support determines whether CONFIG_PROFILE.flood_mode can be set to CFF.
      
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Link: https://lore.kernel.org/r/af727d0e1095e30fa45c7e60404637cdc491aeec.1700503643.git.petrm@nvidia.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      8405d662
    • Jakub Kicinski's avatar
      net: do not send a MOVE event when netdev changes netns · dd891b5b
      Jakub Kicinski authored
      
      
      Networking supports changing netdevice's netns and name
      at the same time. This allows avoiding name conflicts
      and having to rename the interface in multiple steps.
      E.g. netns1={eth0, eth1}, netns2={eth1} - we want
      to move netns1:eth1 to netns2 and call it eth0 there.
      If we can't rename "in flight" we'd need to (1) rename
      eth1 -> $tmp, (2) change netns, (3) rename $tmp -> eth0.
      
      To rename the underlying struct device we have to call
      device_rename(). The rename()'s MOVE event, however, doesn't
      "belong" to either the old or the new namespace.
      If there are conflicts on both sides it's actually impossible
      to issue a real MOVE (old name -> new name) without confusing
      user space. And Daniel reports that such confusions do in fact
      happen for systemd, in real life.
      
      Since we already issue explicit REMOVE and ADD events
      manually - suppress the MOVE event completely. Move
      the ADD after the rename, so that the REMOVE uses
      the old name, and the ADD the new one.
      
      If there is no rename this changes the picture as follows:
      
      Before:
      
      old ns | KERNEL[213.399289] remove   /devices/virtual/net/eth0 (net)
      new ns | KERNEL[213.401302] add      /devices/virtual/net/eth0 (net)
      new ns | KERNEL[213.401397] move     /devices/virtual/net/eth0 (net)
      
      After:
      
      old ns | KERNEL[266.774257] remove   /devices/virtual/net/eth0 (net)
      new ns | KERNEL[266.774509] add      /devices/virtual/net/eth0 (net)
      
      If there is a rename and a conflict (using the exact eth0/eth1
      example explained above) we get this:
      
      Before:
      
      old ns | KERNEL[224.316833] remove   /devices/virtual/net/eth1 (net)
      new ns | KERNEL[224.318551] add      /devices/virtual/net/eth1 (net)
      new ns | KERNEL[224.319662] move     /devices/virtual/net/eth0 (net)
      
      After:
      
      old ns | KERNEL[333.033166] remove   /devices/virtual/net/eth1 (net)
      new ns | KERNEL[333.035098] add      /devices/virtual/net/eth0 (net)
      
      Note that "in flight" rename is only performed when needed.
      If there is no conflict for old name in the target netns -
      the rename will be performed separately by dev_change_name(),
      as if the rename was a different command, and there will still
      be a MOVE event for the rename:
      
      Before:
      
      old ns | KERNEL[194.416429] remove   /devices/virtual/net/eth0 (net)
      new ns | KERNEL[194.418809] add      /devices/virtual/net/eth0 (net)
      new ns | KERNEL[194.418869] move     /devices/virtual/net/eth0 (net)
      new ns | KERNEL[194.420866] move     /devices/virtual/net/eth1 (net)
      
      After:
      
      old ns | KERNEL[71.917520] remove   /devices/virtual/net/eth0 (net)
      new ns | KERNEL[71.919155] add      /devices/virtual/net/eth0 (net)
      new ns | KERNEL[71.920729] move     /devices/virtual/net/eth1 (net)
      
      If deleting the MOVE event breaks some user space we should insert
      an explicit kobject_uevent(MOVE) after the ADD, like this:
      
      @@ -11192,6 +11192,12 @@ int __dev_change_net_namespace(struct net_device *dev, struct net *net,
       	kobject_uevent(&dev->dev.kobj, KOBJ_ADD);
       	netdev_adjacent_add_links(dev);
      
      +	/* User space wants an explicit MOVE event, issue one unless
      +	 * dev_change_name() will get called later and issue one.
      +	 */
      +	if (!pat || new_name[0])
      +		kobject_uevent(&dev->dev.kobj, KOBJ_MOVE);
      +
       	/* Adapt owner in case owning user namespace of target network
       	 * namespace is different from the original one.
       	 */
      
      Reported-by: default avatarDaniel Gröber <dxld@darkboxed.org>
      Link: https://lore.kernel.org/all/20231010121003.x3yi6fihecewjy4e@House.clients.dxld.at/
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Link: https://lore.kernel.org/all/20231120184140.578375-1-kuba@kernel.org/
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      dd891b5b
    • Jose Ignacio Tornos Martinez's avatar
      net: usb: ax88179_178a: avoid two consecutive device resets · d2689b6a
      Jose Ignacio Tornos Martinez authored
      
      
      The device is always reset two consecutive times (ax88179_reset is called
      twice), one from usbnet_probe during the device binding and the other from
      usbnet_open.
      
      Remove the non-necessary reset during the device binding and let the reset
      operation from open to keep the normal behavior (tested with generic ASIX
      Electronics Corp. AX88179 Gigabit Ethernet device).
      
      Reported-by: default avatarHerb Wei <weihao.bj@ieisystem.com>
      Tested-by: default avatarHerb Wei <weihao.bj@ieisystem.com>
      Signed-off-by: default avatarJose Ignacio Tornos Martinez <jtornosm@redhat.com>
      Link: https://lore.kernel.org/r/20231120121239.54504-1-jtornosm@redhat.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      d2689b6a
  2. Nov 21, 2023