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 B8CDF45E16; Tue, 3 Dec 2024 17:41:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 61BFC402BD; Tue, 3 Dec 2024 17:41:53 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by mails.dpdk.org (Postfix) with ESMTP id D018340264 for ; Tue, 3 Dec 2024 17:41:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733244111; x=1764780111; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xcgmwGzIhJtvxPppekl6yBM3yyKX49/PJw/5LgFGDHs=; b=Nf7m5lPEWp54PGARZQaz+pLlG5oZQAdN9YfurRxJhkmc0iLQUnUnFlDu vOsMGjP8m4e2k3Ni6S9YcVQ4sxeynLjg+ea0RxHX/9ui9/nIEYqHEcfmu 3y6vicAtqCrmIPYzETL5FlpQiuNSFG0pwZdotazSc1hvoUHkrZyZsnLij jCPTB84R/Saln0a3yP9BSjITTcAqeh1yupCbMvo5uCWFlUnLBzFcv9Iup 7yTc/TryhIt7FORLe1yBlrSmDekj4bCpP6uVPJOWs4F3cPW4jpCqPYeIz uAvO5cl4ABRztJymvscjn5ldSvY6TGo+CmOgDjNE0lRHKluhwp2qASxLY g==; X-CSE-ConnectionGUID: 0+XM2uW7QJesS8FFXQUIDQ== X-CSE-MsgGUID: 8vPTpx5kTJe2TWPcz9suIA== X-IronPort-AV: E=McAfee;i="6700,10204,11275"; a="33620723" X-IronPort-AV: E=Sophos;i="6.12,205,1728975600"; d="scan'208";a="33620723" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2024 08:41:50 -0800 X-CSE-ConnectionGUID: i07AFyxeSdSIJgO4w6bL7g== X-CSE-MsgGUID: 1g8jWUQdQkKQ6ExWS+esaQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,205,1728975600"; d="scan'208";a="93357690" Received: from silpixa00401197coob.ir.intel.com (HELO silpixa00401385.ir.intel.com) ([10.237.214.45]) by orviesa010.jf.intel.com with ESMTP; 03 Dec 2024 08:41:50 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [PATCH v2 00/22] Reduce code duplication across Intel NIC drivers Date: Tue, 3 Dec 2024 16:41:06 +0000 Message-ID: <20241203164132.2686558-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. 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