From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7D62D45EFA; Fri, 20 Dec 2024 15:39:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4B66740144; Fri, 20 Dec 2024 15:39:38 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by mails.dpdk.org (Postfix) with ESMTP id B8FAD4003C for ; Fri, 20 Dec 2024 15:39:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1734705577; x=1766241577; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OnNDZ5jhWx0fGVtH5mM6VB09Jf1G8N5ccVWG/J8UVlY=; b=ikHAeYGbA9bjMctDsLCbfqYqrXDCh+mWaGPjFFLx81plDqHFGPuJpguT wf1Wr59NrbibZaRzf5CNMGuKOgE0lwjwiwjURh/W8jmzBzJuxgpAvcByk ZN/oQeZzTXLbFu/mrS+2eMg3ut49RNIRp9KURoAhBzyra1BaqmiRJgwVa aggySGEFAankbZjE/TP4IgSpkE3ew0nLdyK/DSgUFnMa+BTihN6T2YN3i 06ghpb4+2RcD4O/VUyMvcyjj0iRei6kBC+lu7ZvCPveg/FEgM0dPfHwSR uNrgh0qvyarJL5krFM8zz7pDTLSkTV/Z1HIIBuluohHoNBkiWNLYp2vs2 Q==; X-CSE-ConnectionGUID: TXet9P3gQeycvab8TW+AlQ== X-CSE-MsgGUID: spjLQGr9S1qzTsOVO4y6pQ== X-IronPort-AV: E=McAfee;i="6700,10204,11292"; a="39040094" X-IronPort-AV: E=Sophos;i="6.12,251,1728975600"; d="scan'208";a="39040094" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 06:39:36 -0800 X-CSE-ConnectionGUID: TjFvHPRRTbWKPHZYCn36/g== X-CSE-MsgGUID: uofE6HNpT9WyQJxNEG/9aw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,251,1728975600"; d="scan'208";a="98310516" Received: from silpixa00401197coob.ir.intel.com (HELO silpixa00401385.ir.intel.com) ([10.237.214.45]) by fmviesa006.fm.intel.com with ESMTP; 20 Dec 2024 06:39:34 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [PATCH v4 00/24] Reduce code duplication across Intel NIC drivers Date: Fri, 20 Dec 2024 14:38:57 +0000 Message-ID: <20241220143925.609044-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241122125418.2857301-1-bruce.richardson@intel.com> References: <20241122125418.2857301-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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. v3->v4: * Add patches 23 & 24 to set, to do a little more dedupliation on Rx side v2->v3: * Fix incorrect/unadjusted memset in patch 8, leading to incorrect threshold tracking in ixgbe. 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 (24): 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 net/_common_intel: create common mbuf initializer fn net/_common_intel: extract common Rx vector criteria drivers/net/_common_intel/rx.h | 112 ++++++++ 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 | 30 ++- 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 | 198 +------------- drivers/net/i40e/i40e_rxtx_vec_neon.c | 30 ++- drivers/net/i40e/i40e_rxtx_vec_sse.c | 30 ++- 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 | 195 +++++--------- drivers/net/iavf/iavf_rxtx.h | 62 +---- 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 | 178 +------------ drivers/net/iavf/iavf_rxtx_vec_neon.c | 3 +- drivers/net/iavf/iavf_rxtx_vec_sse.c | 59 ++--- 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 | 222 +--------------- drivers/net/ice/ice_rxtx_vec_sse.c | 35 ++- 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 | 156 ++--------- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 40 ++- drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 40 ++- drivers/net/ixgbe/meson.build | 2 +- 47 files changed, 1000 insertions(+), 2027 deletions(-) create mode 100644 drivers/net/_common_intel/rx.h create mode 100644 drivers/net/_common_intel/tx.h -- 2.43.0