1. 27 Oct, 2021 24 commits
    • Vladimir Oltean's avatar
      net: bridge: reduce indentation level in fdb_create · 9574fb55
      Vladimir Oltean authored
      We can express the same logic without an "if" condition as big as the
      function, just return early if the kmem_cache_alloc() call fails.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Acked-by: default avatarNikolay Aleksandrov <nikolay@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9574fb55
    • Vladimir Oltean's avatar
      net: bridge: rename br_fdb_insert to br_fdb_add_local · f6814fdc
      Vladimir Oltean authored
      br_fdb_insert() is a wrapper over fdb_insert() that also takes the
      bridge hash_lock.
      
      With fdb_insert() being renamed to fdb_add_local(), rename
      br_fdb_insert() to br_fdb_add_local().
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Acked-by: default avatarNikolay Aleksandrov <nikolay@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f6814fdc
    • Vladimir Oltean's avatar
      net: bridge: rename fdb_insert to fdb_add_local · 4731b6d6
      Vladimir Oltean authored
      fdb_insert() is not a descriptive name for this function, and also easy
      to confuse with __br_fdb_add(), fdb_add_entry(), br_fdb_update().
      Even more confusingly, it is not even related in any way with those
      functions, neither one calls the other.
      
      Since fdb_insert() basically deals with the creation of a BR_FDB_LOCAL
      entry and is called only from functions where that is the intention:
      
      - br_fdb_changeaddr
      - br_fdb_change_mac_address
      - br_fdb_insert
      
      then rename it to fdb_add_local(), because its removal counterpart is
      called fdb_delete_local().
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Acked-by: default avatarNikolay Aleksandrov <nikolay@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4731b6d6
    • Vladimir Oltean's avatar
      net: bridge: remove fdb_insert forward declaration · 5f94a5e2
      Vladimir Oltean authored
      fdb_insert() has a forward declaration because its first caller,
      br_fdb_changeaddr(), is declared before fdb_create(), a function which
      fdb_insert() needs.
      
      This patch moves the 2 functions above br_fdb_changeaddr() and deletes
      the forward declaration for fdb_insert().
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Acked-by: default avatarNikolay Aleksandrov <nikolay@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5f94a5e2
    • Vladimir Oltean's avatar
      net: bridge: remove fdb_notify forward declaration · 4682048a
      Vladimir Oltean authored
      fdb_notify() has a forward declaration because its first caller,
      fdb_delete(), is declared before 3 functions that fdb_notify() needs:
      fdb_to_nud(), fdb_fill_info() and fdb_nlmsg_size().
      
      This patch moves the aforementioned 4 functions above fdb_delete() and
      deletes the forward declaration.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Acked-by: default avatarNikolay Aleksandrov <nikolay@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4682048a
    • David S. Miller's avatar
      Merge branch 'mvneta-phylink' · e334df1d
      David S. Miller authored
      Russell King says:
      
      ====================
      Convert mvneta to phylink supported_interfaces
      
      This patch series converts mvneta to use phylinks supported_interfaces
      bitmap to simplify the validate() implementation. The patches:
      
      1) Add the supported interface modes the supported_interfaces bitmap.
      2) Removes the checks for the interface type being supported from
         the validate callback
      3) Removes the now unnecessary checks and call to
         phylink_helper_basex_speed() to support switching between
         1000base-X and 2500base-X for SFPs
      
      (3) becomes possible because when asking the MAC for its complete
      support, we walk all supported interfaces which will include 1000base-X
      and 2500base-X only if the comphy is present.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e334df1d
    • Russell King (Oracle)'s avatar
      net: mvneta: drop use of phylink_helper_basex_speed() · 099cbfa2
      Russell King (Oracle) authored
      Now that we have a better method to select SFP interface modes, we
      no longer need to use phylink_helper_basex_speed() in a driver's
      validation function, and we can also get rid of our hack to indicate
      both 1000base-X and 2500base-X if the comphy is present to make that
      work. Remove this hack and use of phylink_helper_basex_speed().
      Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      099cbfa2
    • Russell King (Oracle)'s avatar
      net: mvneta: remove interface checks in mvneta_validate() · d9ca7280
      Russell King (Oracle) authored
      As phylink checks the interface mode against the supported_interfaces
      bitmap, we no longer need to validate the interface mode in the
      validation function. Remove this to simplify it.
      Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d9ca7280
    • Russell King's avatar
      net: mvneta: populate supported_interfaces member · fdedb695
      Russell King authored
      Populate the phy_interface_t bitmap for the Marvell mvneta driver with
      interfaces modes supported by the MAC.
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fdedb695
    • David S. Miller's avatar
      Merge tag 'mlx5-updates-2021-10-26' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux · c230dc86
      David S. Miller authored
      Saeed Mahameed says:
      
      ====================
      mlx5-updates-2021-10-26
      
      HW-GRO support in mlx5
      
      Beside the HW GRO this series includes two trivial non-mlx5 patches:
       - net: Prevent HW-GRO and LRO features operate together
       - lib: bitmap: Introduce node-aware alloc API
      
      Khalid Manaa Says:
      ==================
      This series implements the HW-GRO offload using the HW feature SHAMPO.
      
      HW-GRO: Hardware offload for the Generic Receive Offload feature.
      
      SHAMPO: Split Headers And Merge Payload Offload.
      
      This feature performs headers data split for each received packed and
      merge the payloads of the packets of the same session.
      
      There are new HW components for this feature:
      
      The headers buffer:
      – cyclic buffer where the packets headers will be located
      
      Reservation buffer:
      – capability to divide RQ WQEs to reservations, a definite size in
        granularity of 4KB, the reservation is used to define the largest segment
        that we can create by packets stitching.
      
      Each reservation will have a session and the new received packet can be merged
      to the session, terminate it, or open a new one according to the match criteria.
      
      When a new packet is received the headers will be written to the headers buffer
      and the data will be written to the reservation, in case the packet matches
      the session the data will be written continuously otherwise it will be written
      after performing an alignment.
      
      SHAMPO RQ, WQ and CQE changes:
      -----------------------------
      RQ (receive queue) new params:
      
       -shampo_no_match_alignment_granularity: the HW alignment granularity in case
        the received packet doesn't match the current session.
      
       -shampo_match_criteria_type: the type of match criteria.
      
       -reservation_timeout: the maximum time that the HW will hold the reservation.
      
       -Each RQ has SKB that represents the current opened flow.
      
      WQ (work queue) new params:
      
       -headers_mkey: mkey that represents the headers buffer, where the packets
        headers will be written by the HW.
      
       -shampo_enable: flag to verify if the WQ supports SHAMPO feature.
      
       -log_reservation_size: the log of the reservation size where the data of
        the packet will be written by the HW.
      
       -log_max_num_of_packets_per_reservation: log of the maximum number of packets
        that can be written to the same reservation.
      
       -log_headers_entry_size: log of the header entry size of the headers buffer.
      
       -log_headers_buffer_entry_num: log of the entries number of the headers buffer.
      
      CQEs (Completion queue entry) SHAMPO fields:
      
       -match: in case it is set, then the current packet matches the opened session.
      
       -flush: in case it is set, the opened session must be flushed.
      
       -header_size: the size of the packet’s headers.
      
       -header_entry_index: the entry index in the headers buffer of the received
        packet headers.
      
       -data_offset: the offset of the received packet data in the WQE.
      
      HW-GRO works as follow:
      ----------------------
      The feature can be enabled on the interface using the ethtool command by
      setting on rx-gro-hw. When the feature is on the mlx5 driver will reopen
      the RQ to support the SHAMPO feature:
      
      Will allocate the headers buffer and fill the parameters regarding the
      reservation and the match criteria.
      
      Receive packet flow:
      
      each RQ will hold SKB that represents the current GRO opened session.
      
      The driver has a new CQE handler mlx5e_handle_rx_cqe_mpwrq_shampo which will
      use the CQE SHAMPO params to extract the location of the packet’s headers
      in the headers buffer and the location of the packets data in the RQ.
      
      Also, the CQE has two flags flush and match that indicate if the current
      packet matches the current session or not and if we need to close the session.
      
      In case there is an opened session, and we receive a matched packet then the
      handler will merge the packet's payload to the current SKB, in case we receive
      no match then the handler will flush the SKB and create a new one for the new packet.
      
      In case the flash flag is set then the driver will close the session, the SKB
      will be passed to the network stack.
      
      In case the driver merges packets in the SKB, before passing the SKB to the network
      stack the driver will update the checksum of the packet’s headers.
      
      SKB build:
      ---------
      The driver will build a new SKB in the following situations:
      in case there is no current opened session.
      In case the current packet doesn’t match the current session.
      In case there is no place to add the packets data to the SKB that represents the
      current session.
      
      Otherwise, the driver will add the packet’s data to the SKB.
      
      When the driver builds a new SKB, the linear area will contain only the packet headers
      and the data will be added to the SKB fragments.
      
      In case the entry size of the headers buffer is sufficient to build the SKB
      it will be used, otherwise the driver will allocate new memory to build the SKB.
      
      ==================
      
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c230dc86
    • Maor Dickman's avatar
      net/mlx5: Lag, Make mlx5_lag_is_multipath() be static inline · 8ca9caee
      Maor Dickman authored
      Fix "no previous prototype" W=1 warnings when CONFIG_MLX5_CORE_EN is not set:
      
        drivers/net/ethernet/mellanox/mlx5/core/lag_mp.h:34:6: error: no previous prototype for ‘mlx5_lag_is_multipath’ [-Werror=missing-prototypes]
           34 | bool mlx5_lag_is_multipath(struct mlx5_core_dev *dev) { return false; }
              |      ^~~~~~~~~~~~~~~~~~~~~
      
      Fixes: 14fe2471 ("net/mlx5: Lag, change multipath and bonding to be mutually exclusive")
      Signed-off-by: default avatarMaor Dickman <maord@nvidia.com>
      8ca9caee
    • Khalid Manaa's avatar
      net/mlx5e: Prevent HW-GRO and CQE-COMPRESS features operate together · ae345299
      Khalid Manaa authored
      HW-GRO and CQE-COMPRESS are mutually exclusive, this commit adds this
      restriction.
      Signed-off-by: default avatarKhalid Manaa <khalidm@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      ae345299
    • Khalid Manaa's avatar
      net/mlx5e: Add HW-GRO offload · 83439f3c
      Khalid Manaa authored
      This commit introduces HW-GRO offload by using the SHAMPO feature
      - Add set feature handler for HW-GRO.
      Signed-off-by: default avatarBen Ben-Ishay <benishay@nvidia.com>
      Signed-off-by: default avatarKhalid Manaa <khalidm@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      83439f3c
    • Khalid Manaa's avatar
      net/mlx5e: Add HW_GRO statistics · def09e7b
      Khalid Manaa authored
      This patch adds HW_GRO counters to RX packets statistics:
       - gro_match_packets: counter of received packets with set match flag.
      
       - gro_packets: counter of received packets over the HW_GRO feature,
                      this counter is increased by one for every received
                      HW_GRO cqe.
      
       - gro_bytes: counter of received bytes over the HW_GRO feature,
                    this counter is increased by the received bytes for every
                    received HW_GRO cqe.
      
       - gro_skbs: counter of built HW_GRO skbs,
                   increased by one when we flush HW_GRO skb
                   (when we call a napi_gro_receive with hw_gro skb).
      
       - gro_large_hds: counter of received packets with large headers size,
                        in case the packet needs new SKB, the driver will allocate
                        new one and will not use the headers entry to build it.
      Signed-off-by: default avatarKhalid Manaa <khalidm@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      def09e7b
    • Khalid Manaa's avatar
      net/mlx5e: HW_GRO cqe handler implementation · 92552d3a
      Khalid Manaa authored
      this patch updates the SHAMPO CQE handler to support HW_GRO,
      
      changes in the SHAMPO CQE handler:
      - CQE match and flush fields are used to determine if to build new skb
        using the new received packet,
        or to add the received packet data to the existing RQ.hw_gro_skb,
        also this fields are used to determine when to flush the skb.
      - in the end of the function mlx5e_poll_rx_cq the RQ.hw_gro_skb is flushed.
      Signed-off-by: default avatarKhalid Manaa <khalidm@nvidia.com>
      Signed-off-by: default avatarBen Ben-Ishay <benishay@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      92552d3a
    • Ben Ben-Ishay's avatar
      net/mlx5e: Add data path for SHAMPO feature · 64509b05
      Ben Ben-Ishay authored
      The header buffer is used to store the headers of the rx packets.
      The header buffer size deduced from WorkQueue size + restriction
      of max packets per WorkQueueElement.
      This commit adds the functionality for posting/updating memory for
      the header buffer during the posting/updating of WQEs.
      Signed-off-by: default avatarBen Ben-Ishay <benishay@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      64509b05
    • Khalid Manaa's avatar
      net/mlx5e: Add handle SHAMPO cqe support · f97d5c2a
      Khalid Manaa authored
      This patch adds the new CQE SHAMPO fields:
      - flush: indicates that we must close the current session and pass the SKB
               to the network stack.
      
      - match: indicates that the current packet matches the oppened session,
               the packet will be merge into the current SKB.
      
      - header_size: the size of the packet headers that written into the headers
                     buffer.
      
      - header_entry_index: the entry index in the headers buffer.
      
      - data_offset: packets data offset in the WQE.
      
      Also new cqe handler is added to handle SHAMPO packets:
      - The new handler uses CQE SHAMPO fields to build the SKB.
        CQE's Flush and match fields are not used in this patch, packets are not
        merged in this patch.
      Signed-off-by: default avatarKhalid Manaa <khalidm@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      f97d5c2a
    • Ben Ben-Ishay's avatar
      net/mlx5e: Add control path for SHAMPO feature · e5ca8fb0
      Ben Ben-Ishay authored
      This commit introduces the control path infrastructure for SHAMPO feature.
      
      SHAMPO feature enables packet stitching by splitting packets to
      header and payload, the header is placed on a dedicated buffer
      and the payload on the RX ring, this allows stitching the data part
      of a flow together continuously in the receive buffer.
      
      SHAMPO feature is implemented as linked list striding RQ feature.
      To support packets splitting and payload stitching:
      - Enlarge the ICOSQ and the correspond CQ to support the header buffer
        memory regions.
      - Add support to create linked list striding RQ with SHAMPO feature set
        in the open_rq function.
      - Add deallocation function and corresponded calls for SHAMPO header
        buffer.
      - Add mlx5e_create_umr_klm_mkey to support KLM mkey for the header
        buffer.
      - Rename mlx5e_create_umr_mkey to mlx5e_create_umr_mtt_mkey.
      Signed-off-by: default avatarBen Ben-Ishay <benishay@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      e5ca8fb0
    • Ben Ben-Ishay's avatar
      net/mlx5e: Add support to klm_umr_wqe · d7b896ac
      Ben Ben-Ishay authored
      This commit adds the needed definitions for using the klm_umr_wqe.
      UMR stands for user-mode memory registration, is a mechanism to alter
      address translation properties of MKEY by posting WorkQueueElement
      aka WQE on send queue.
      MKEY stands for memory key, MKEY are used to describe a region in memory that
      can be later used by HW.
      KLM stands for {Key, Length, MemVa}, KLM_MKEY is indirect MKEY that enables
      to map multiple memory spaces with different sizes in unified MKEY.
      klm_umr_wqe is a UMR that use to update a KLM_MKEY.
      SHAMPO feature uses KLM_MKEY for memory registration of his header buffer.
      Signed-off-by: default avatarBen Ben-Ishay <benishay@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      d7b896ac
    • Khalid Manaa's avatar
      net/mlx5e: Rename TIR lro functions to TIR packet merge functions · eaee12f0
      Khalid Manaa authored
      This series introduces new packet merge type, therefore rename lro
      functions to packet merge to support the new merge type:
      - Generalize + rename mlx5e_build_tir_ctx_lro to
        mlx5e_build_tir_ctx_packet_merge.
      - Rename mlx5e_modify_tirs_lro to mlx5e_modify_tirs_packet_merge.
      - Rename lro bit in mlx5_ifc_modify_tir_bitmask_bits to packet_merge.
      - Rename lro_en in mlx5e_params to packet_merge_type type and combine
        packet_merge params into one struct mlx5e_packet_merge_param.
      Signed-off-by: default avatarKhalid Manaa <khalidm@nvidia.com>
      Signed-off-by: default avatarBen Ben-Ishay <benishay@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      eaee12f0
    • Ben Ben-Ishay's avatar
      net/mlx5: Add SHAMPO caps, HW bits and enumerations · 7025329d
      Ben Ben-Ishay authored
      This commit adds SHAMPO bit to hca_cap and SHAMPO capabilities structure,
      SHAMPO related HW spec hardware fields and enumerations.
      SHAMPO stands for: split headers and merge payload offload.
      SHAMPO new fields:
      WQ:
       - headers_mkey: mkey that represents the headers buffer, where the packets
         headers will be written by the HW.
      
       - shampo_enable: flag to verify if the WQ supports SHAMPO feature.
      
       - log_reservation_size: the log of the reservation size where the data of
         the packet will be written by the HW.
      
       - log_max_num_of_packets_per_reservation: log of the maximum number of
         packets that can be written to the same reservation.
      
       - log_headers_entry_size: log of the header entry size of the headers buffer.
      
       - log_headers_buffer_entry_num: log of the entries number of the headers buffer.
      
      RQ:
       - shampo_no_match_alignment_granularity: the HW alignment granularity
         in case the received packet doesn't match the current session.
      
       - shampo_match_criteria_type: the type of match criteria.
      
       - reservation_timeout: the maximum time that the HW will hold the
         reservation.
      
      mlx5_ifc_shampo_cap_bits, the capabilities of the SHAMPO feature:
       - shampo_log_max_reservation_size: the maximum allowed value of the field
         WQ.log_reservation_size.
      
       - log_reservation_size: the minimum allowed value of the field
         WQ.log_reservation_size.
      
       - shampo_min_mss_size: the minimum payload size of packet that can open
         a new session or be merged to a session.
      
       - shampo_max_log_headers_entry_size: the maximum allowed value of the field
         WQ.log_headers_entry_size
      Signed-off-by: default avatarBen Ben-Ishay <benishay@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      7025329d
    • Ben Ben-Ishay's avatar
      net/mlx5e: Rename lro_timeout to packet_merge_timeout · 50f477fe
      Ben Ben-Ishay authored
      TIR stands for transport interface receive, the TIR object is
      responsible for performing all transport related operations on
      the receive side like packet processing, demultiplexing the packets
      to different RQ's, etc.
      lro_timeout is a field in the TIR that is used to set the timeout for lro
      session, this series introduces new packet merge type, therefore rename
      lro_timeout to packet_merge_timeout for all packet merge types.
      Signed-off-by: default avatarBen Ben-Ishay <benishay@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      50f477fe
    • Ben Ben-ishay's avatar
      net: Prevent HW-GRO and LRO features operate together · 54b2b3ec
      Ben Ben-ishay authored
      LRO and HW-GRO are mutually exclusive, this commit adds this restriction
      in netdev_fix_feature. HW-GRO is preferred, that means in case both
      HW-GRO and LRO features are requested, LRO is cleared.
      Signed-off-by: default avatarBen Ben-ishay <benishay@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      54b2b3ec
    • Tariq Toukan's avatar
      lib: bitmap: Introduce node-aware alloc API · 7529cc7f
      Tariq Toukan authored
      Expose new node-aware API for bitmap allocation:
      bitmap_alloc_node() / bitmap_zalloc_node().
      Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Reviewed-by: default avatarMoshe Shemesh <moshe@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      7529cc7f
  2. 26 Oct, 2021 16 commits