mbox series

[v2,00/22] Reduce code duplication across Intel NIC drivers

Message ID 20241203164132.2686558-1-bruce.richardson@intel.com (mailing list archive)
Headers
Series Reduce code duplication across Intel NIC drivers |

Message

Bruce Richardson Dec. 3, 2024, 4:41 p.m. UTC
This RFC attempts to reduce the amount of code duplication across a
number of Intel NIC drivers, specifically: ixgbe, i40e, iavf, and ice.

The first patch extract a function from the Rx side, otherwise the
majority of the changes are on the Tx side, leading to a converged Tx
queue structure across the 4 drivers, and a large number of common
functions.

v1->v2:
* Fix two additional checkpatch issues that were flagged.
* Added in patch 21, which performs additional cleanup that is possible
  once all vector drivers use the same mbuf free/release process.
  [This brings the patchset to having over twice as many lines removed
  as added (1887 vs 930), and close to having a net removal of 1kloc]

RFC->v1:
* Moved the location of the common code from "common/intel_eth" to
  "net/_common_intel", and added only ".." to the driver include path so
  that the paths included "_common_intel" in them, to make it clear it's
  not driver-local headers.
* Due to change in location, structure/fn prefix changes from "ieth" to
  "ci" for "common intel".
* Removed the seeming-arbitrary split of vector and non-vector code -
  since much of the code taken from vector files was scalar code which
  was used by the vector drivers.
* Split code into separate Rx and Tx files.
* Fixed multiple checkpatch issues (but not all).
* Attempted to improve name standardization, by using "_vec" as a common
  suffix for all vector-related fns and data. Previously, some names had
  "vec" in the middle, others had just "_v" suffix or full word "vector"
  as suffix.
* Other minor changes...

Bruce Richardson (22):
  net/_common_intel: add pkt reassembly fn for intel drivers
  net/_common_intel: provide common Tx entry structures
  net/_common_intel: add Tx mbuf ring replenish fn
  drivers/net: align Tx queue struct field names
  drivers/net: add prefix for driver-specific structs
  net/_common_intel: merge ice and i40e Tx queue struct
  net/iavf: use common Tx queue structure
  net/ixgbe: convert Tx queue context cache field to ptr
  net/ixgbe: use common Tx queue structure
  net/_common_intel: pack Tx queue structure
  net/_common_intel: add post-Tx buffer free function
  net/_common_intel: add Tx buffer free fn for AVX-512
  net/iavf: use common Tx free fn for AVX-512
  net/ice: move Tx queue mbuf cleanup fn to common
  net/i40e: use common Tx queue mbuf cleanup fn
  net/ixgbe: use common Tx queue mbuf cleanup fn
  net/iavf: use common Tx queue mbuf cleanup fn
  net/ice: use vector SW ring for all vector paths
  net/i40e: use vector SW ring for all vector paths
  net/iavf: use vector SW ring for all vector paths
  net/_common_intel: remove unneeded code
  net/ixgbe: use common Tx backlog entry fn

 drivers/net/_common_intel/rx.h                |  79 ++++++
 drivers/net/_common_intel/tx.h                | 249 ++++++++++++++++++
 drivers/net/i40e/i40e_ethdev.c                |   4 +-
 drivers/net/i40e/i40e_ethdev.h                |   8 +-
 drivers/net/i40e/i40e_fdir.c                  |  10 +-
 .../net/i40e/i40e_recycle_mbufs_vec_common.c  |   6 +-
 drivers/net/i40e/i40e_rxtx.c                  | 192 +++++---------
 drivers/net/i40e/i40e_rxtx.h                  |  61 +----
 drivers/net/i40e/i40e_rxtx_vec_altivec.c      |  26 +-
 drivers/net/i40e/i40e_rxtx_vec_avx2.c         |  26 +-
 drivers/net/i40e/i40e_rxtx_vec_avx512.c       | 144 +---------
 drivers/net/i40e/i40e_rxtx_vec_common.h       | 144 +---------
 drivers/net/i40e/i40e_rxtx_vec_neon.c         |  26 +-
 drivers/net/i40e/i40e_rxtx_vec_sse.c          |  26 +-
 drivers/net/i40e/meson.build                  |   2 +-
 drivers/net/iavf/iavf.h                       |   2 +-
 drivers/net/iavf/iavf_ethdev.c                |   4 +-
 drivers/net/iavf/iavf_rxtx.c                  | 180 +++++--------
 drivers/net/iavf/iavf_rxtx.h                  |  61 +----
 drivers/net/iavf/iavf_rxtx_vec_avx2.c         |  47 ++--
 drivers/net/iavf/iavf_rxtx_vec_avx512.c       | 214 +++------------
 drivers/net/iavf/iavf_rxtx_vec_common.h       | 160 +----------
 drivers/net/iavf/iavf_rxtx_vec_sse.c          |  56 ++--
 drivers/net/iavf/iavf_vchnl.c                 |   8 +-
 drivers/net/iavf/meson.build                  |   2 +-
 drivers/net/ice/ice_dcf.c                     |   4 +-
 drivers/net/ice/ice_dcf_ethdev.c              |  21 +-
 drivers/net/ice/ice_diagnose.c                |   2 +-
 drivers/net/ice/ice_ethdev.c                  |   2 +-
 drivers/net/ice/ice_ethdev.h                  |   7 +-
 drivers/net/ice/ice_rxtx.c                    | 163 +++++-------
 drivers/net/ice/ice_rxtx.h                    |  52 +---
 drivers/net/ice/ice_rxtx_vec_avx2.c           |  26 +-
 drivers/net/ice/ice_rxtx_vec_avx512.c         | 153 +----------
 drivers/net/ice/ice_rxtx_vec_common.h         | 190 +------------
 drivers/net/ice/ice_rxtx_vec_sse.c            |  32 +--
 drivers/net/ice/meson.build                   |   2 +-
 drivers/net/ixgbe/base/ixgbe_osdep.h          |   2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              |   4 +-
 .../ixgbe/ixgbe_recycle_mbufs_vec_common.c    |   6 +-
 drivers/net/ixgbe/ixgbe_rxtx.c                | 139 +++++-----
 drivers/net/ixgbe/ixgbe_rxtx.h                |  73 +----
 drivers/net/ixgbe/ixgbe_rxtx_vec_common.h     | 128 ++-------
 drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c       |  37 ++-
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c        |  37 ++-
 drivers/net/ixgbe/meson.build                 |   2 +-
 46 files changed, 930 insertions(+), 1889 deletions(-)
 create mode 100644 drivers/net/_common_intel/rx.h
 create mode 100644 drivers/net/_common_intel/tx.h

--
2.43.0