1. 03 Oct, 2022 31 commits
  2. 02 Oct, 2022 4 commits
  3. 01 Oct, 2022 5 commits
    • Jakub Kicinski's avatar
      Merge branch 'mlx5-xsk-updates-part3-2022-09-30' · bc37b24e
      Jakub Kicinski authored
      Saeed Mahameed says:
      
      ====================
      mlx5 xsk updates part3 2022-09-30
      
      The gist of this 4 part series is in this patchset's last patch
      
      This series contains performance optimizations. XSK starts using the
      batching allocator, and XSK data path gets separated from the regular
      RX, allowing to drop some branches not relevant for non-XSK use cases.
      Some minor optimizations for indirect calls and need_wakeup are also
      included.
      
      Other than that, this series adds a few features to the mlx5e
      implementation of XSK:
      
      1. XDP metadata support on XSK RQs.
      
      2. RSS contexts support for XSK RQs.
      
      3. Some other optimizations
      
      4. Last but not least, change the queuing scheme, so that XSK RQs no longer
      use higher indices, but replace the regular RQs.
      
      Maxim Says:
      ==========
      
      In the initial implementation of XSK in mlx5e, XSK RQs coexisted with
      regular RQs in the same channel. The main idea was to allow RSS work the
      same for regular traffic, without need to reconfigure RSS to exclude XSK
      queues.
      
      However, this scheme didn't prove to be beneficial, mainly because of
      incompatibility with other vendors. Some tools don't properly support
      using higher indices for XSK queues, some tools get confused with the
      double amount of RQs exposed in sysfs. Some use cases are purely XSK,
      and allocating the same amount of unused regular RQs is a waste of
      resources.
      
      This commit changes the queuing scheme to the standard one, where XSK
      RQs replace regular RQs on the channels where XSK sockets are open. Two
      RQs still exist in the channel to allow failsafe disable of XSK, but
      only one is exposed at a time. The next commit will achieve the desired
      memory save by flushing the buffers when the regular RQ is unused.
      
      As the result of this transition:
      
      1. It's possible to use RSS contexts over XSK RQs.
      
      2. It's possible to dedicate all queues to XSK.
      
      3. When XSK RQs coexist with regular RQs, the admin should make sure no
      unwanted traffic goes into XSK RQs by either excluding them from RSS or
      settings up the XDP program to return XDP_PASS for non-XSK traffic.
      
      4. When using a mixed fleet of mlx5e devices and other netdevs, the same
      configuration can be applied. If the application supports the fallback
      to copy mode on unsupported drivers, it will work too.
      
      ==========
      
      Part 4 will include some final xsk optimizations and minor improvements
      
      part 1: https://lore.kernel.org/netdev/20220927203611.244301-1-saeed@kernel.org/
      part 2: https://lore.kernel.org/netdev/20220929072156.93299-1-saeed@kernel.org/
      ====================
      
      Link: https://lore.kernel.org/r/20220930162903.62262-1-saeed@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      bc37b24e
    • Maxim Mikityanskiy's avatar
      net/mlx5e: xsk: Use queue indices starting from 0 for XSK queues · 3db4c85c
      Maxim Mikityanskiy authored
      In the initial implementation of XSK in mlx5e, XSK RQs coexisted with
      regular RQs in the same channel. The main idea was to allow RSS work the
      same for regular traffic, without need to reconfigure RSS to exclude XSK
      queues.
      
      However, this scheme didn't prove to be beneficial, mainly because of
      incompatibility with other vendors. Some tools don't properly support
      using higher indices for XSK queues, some tools get confused with the
      double amount of RQs exposed in sysfs. Some use cases are purely XSK,
      and allocating the same amount of unused regular RQs is a waste of
      resources.
      
      This commit changes the queuing scheme to the standard one, where XSK
      RQs replace regular RQs on the channels where XSK sockets are open. Two
      RQs still exist in the channel to allow failsafe disable of XSK, but
      only one is exposed at a time. The next commit will achieve the desired
      memory save by flushing the buffers when the regular RQ is unused.
      
      As the result of this transition:
      
      1. It's possible to use RSS contexts over XSK RQs.
      
      2. It's possible to dedicate all queues to XSK.
      
      3. When XSK RQs coexist with regular RQs, the admin should make sure no
      unwanted traffic goes into XSK RQs by either excluding them from RSS or
      settings up the XDP program to return XDP_PASS for non-XSK traffic.
      
      4. When using a mixed fleet of mlx5e devices and other netdevs, the same
      configuration can be applied. If the application supports the fallback
      to copy mode on unsupported drivers, it will work too.
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      3db4c85c
    • Maxim Mikityanskiy's avatar
      net/mlx5e: Introduce the mlx5e_flush_rq function · d9ba64de
      Maxim Mikityanskiy authored
      Add a function to flush an RQ: clean up descriptors, release pages and
      reset the RQ. This procedure is used by the recovery flow, and it will
      also be used in a following commit to free some memory when switching a
      channel to the XSK mode.
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      d9ba64de
    • Maxim Mikityanskiy's avatar
      net/mlx5e: xsk: Support XDP metadata on XSK RQs · a752b2ed
      Maxim Mikityanskiy authored
      Add support for XDP metadata on XSK RQs for cross-program
      communication. The driver no longer calls xdp_set_data_meta_invalid and
      copies the metadata to a newly allocated SKB on XDP_PASS.
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a752b2ed
    • Maxim Mikityanskiy's avatar
      net/mlx5e: Optimize RQ page deallocation · ddb7afee
      Maxim Mikityanskiy authored
      mlx5e_free_rx_mpwqe loops over all pages of a MPWQE, calling
      mlx5e_page_release for ones that are not scheduled for XDP_TX or
      XDP_REDIRECT; and mlx5e_page_release checks whether it's an XSK RQ or a
      regular one for each page/XSK frame. This check can be moved outside the
      loop to reduce the number of branches.
      
      mlx5e_free_rx_wqe loops over all fragments, calling mlx5e_page_release
      for the ones that are last in a page; and mlx5e_page_release checks
      whether it's an XSK RQ or a regular one for each fragment. Using the
      fact that XSK doesn't support multiple fragments, it can be optimized
      for both XSK and regular usages:
      
      1. Make an early check for XSK and call its deallocator directly, saving
      3 branches (loop condition, frag->last_in_page and selection of
      deallocator).
      
      2. Call the regular deallocator directly in the non-XSK case, saving a
      branch per fragment, except the first one.
      
      After the changes, mlx5e_page_release is removed, as there are no
      callers left.
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ddb7afee