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 001A045EFA; Fri, 20 Dec 2024 15:42:48 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0670C40C35; Fri, 20 Dec 2024 15:40:51 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by mails.dpdk.org (Postfix) with ESMTP id CEDAE402E5 for ; Fri, 20 Dec 2024 15:40:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1734705649; x=1766241649; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=C6eYtalca6LyQNcljbIgt1QWqv5z4mORGpeM9XXNXx0=; b=V3T+vZDPvl+mWYVxr4JZ5X0n98eb7hmmSPHpwv1G1LLWAXOSALffuKza sdB7Rfo+9lYaG83FEj4U8/nBU0sVYSB3VmputO6cGp819gZv/WXQdLOsc Ko2VVvo+oMAWjRp0s+BNQCdQyCrYEeYEwU0mZHxSjBROyvgoB4wiVOog8 TLvI0P4Yf/imRExeXiUvLk/zCEckc/lh9e7ESk8CuJELPbNyvavvtRCoR WFW5Zj2doJYs0Ga6hSY9H1ibvMLI7QSroK+qgAADwvQZHJUfiW/XO6JnJ kZ/dcvhjWWxvHLlU+VVO7ugYpNdM95XTJs5tX4txurjPnCwGSwKbAUNAb A==; X-CSE-ConnectionGUID: IDM/WnoxRxWhkGFPShW2Tw== X-CSE-MsgGUID: 0n6KpqLRRqOPL0E7IFXFiw== X-IronPort-AV: E=McAfee;i="6700,10204,11292"; a="39040282" X-IronPort-AV: E=Sophos;i="6.12,251,1728975600"; d="scan'208";a="39040282" 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:40:49 -0800 X-CSE-ConnectionGUID: cEXzffLgSWqBVkoHzEnyUQ== X-CSE-MsgGUID: NxGr+ovWT4WlQfDe01z3OA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,251,1728975600"; d="scan'208";a="98310756" 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:40:47 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Ian Stokes , Vladimir Medvedkin , Anatoly Burakov Subject: [PATCH v4 24/24] net/_common_intel: extract common Rx vector criteria Date: Fri, 20 Dec 2024 14:39:21 +0000 Message-ID: <20241220143925.609044-25-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220143925.609044-1-bruce.richardson@intel.com> References: <20241122125418.2857301-1-bruce.richardson@intel.com> <20241220143925.609044-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 While some drivers have specific criteria for when a vector driver can be enabled on the Rx path, there are a number of basic criteria which apply across all drivers. Centralize those in the _common_intel folder, and then update drivers to use the common conditional checks. This adds some additional restrictions to some drivers like ixgbe, where those conditions were necessary but never checked. Signed-off-by: Bruce Richardson --- drivers/net/_common_intel/rx.h | 20 +++++++++++++ drivers/net/i40e/i40e_rxtx_vec_common.h | 35 +++++------------------ drivers/net/iavf/iavf_rxtx.c | 15 +--------- drivers/net/iavf/iavf_rxtx.h | 1 + drivers/net/ice/ice_rxtx_vec_common.h | 14 +-------- drivers/net/ixgbe/ixgbe_rxtx_vec_common.h | 7 +++++ 6 files changed, 37 insertions(+), 55 deletions(-) diff --git a/drivers/net/_common_intel/rx.h b/drivers/net/_common_intel/rx.h index ca0485875c..abb01ba5e7 100644 --- a/drivers/net/_common_intel/rx.h +++ b/drivers/net/_common_intel/rx.h @@ -8,6 +8,7 @@ #include #include #include +#include #define CI_RX_BURST 32 @@ -89,4 +90,23 @@ ci_rxq_mbuf_initializer(uint16_t port_id) return mb_def.rearm_data[0]; } +/* basic checks for a vector-driver capable queue. + * Individual drivers may have other further tests beyond this. + */ +static inline bool +ci_rxq_vec_capable(uint16_t nb_desc, uint16_t rx_free_thresh, uint64_t offloads) +{ + if (!rte_is_power_of_2(nb_desc) || + rx_free_thresh < CI_RX_BURST || + (nb_desc % rx_free_thresh) != 0) + return false; + + /* no driver supports timestamping or buffer split on vector path */ + if ((offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) || + (offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT)) + return false; + + return true; +} + #endif /* _COMMON_INTEL_RX_H_ */ diff --git a/drivers/net/i40e/i40e_rxtx_vec_common.h b/drivers/net/i40e/i40e_rxtx_vec_common.h index 1ccdbd3fdb..5d0b777e0d 100644 --- a/drivers/net/i40e/i40e_rxtx_vec_common.h +++ b/drivers/net/i40e/i40e_rxtx_vec_common.h @@ -61,9 +61,6 @@ i40e_rx_vec_dev_conf_condition_check_default(struct rte_eth_dev *dev) struct i40e_adapter *ad = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; - struct i40e_rx_queue *rxq; - uint16_t desc, i; - bool first_queue; /* no QinQ support */ if (rxmode->offloads & RTE_ETH_RX_OFFLOAD_VLAN_EXTEND) @@ -73,31 +70,13 @@ i40e_rx_vec_dev_conf_condition_check_default(struct rte_eth_dev *dev) * Vector mode is allowed only when number of Rx queue * descriptor is power of 2. */ - if (!dev->data->dev_started) { - first_queue = true; - for (i = 0; i < dev->data->nb_rx_queues; i++) { - rxq = dev->data->rx_queues[i]; - if (!rxq) - continue; - desc = rxq->nb_rx_desc; - if (first_queue) - ad->rx_vec_allowed = - rte_is_power_of_2(desc); - else - ad->rx_vec_allowed = - ad->rx_vec_allowed ? - rte_is_power_of_2(desc) : - ad->rx_vec_allowed; - first_queue = false; - } - } else { - /* Only check the first queue's descriptor number */ - for (i = 0; i < dev->data->nb_rx_queues; i++) { - rxq = dev->data->rx_queues[i]; - if (!rxq) - continue; - desc = rxq->nb_rx_desc; - ad->rx_vec_allowed = rte_is_power_of_2(desc); + ad->rx_vec_allowed = true; + for (uint16_t i = 0; i < dev->data->nb_rx_queues; i++) { + struct i40e_rx_queue *rxq = dev->data->rx_queues[i]; + if (!rxq) + continue; + if (!ci_rxq_vec_capable(rxq->nb_rx_desc, rxq->rx_free_thresh, rxq->offloads)) { + ad->rx_vec_allowed = false; break; } } diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 6692f6992b..e4c4b9682c 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -199,19 +199,6 @@ check_tx_thresh(uint16_t nb_desc, uint16_t tx_rs_thresh, return 0; } -static inline bool -check_rx_vec_allow(struct iavf_rx_queue *rxq) -{ - if (rxq->rx_free_thresh >= IAVF_VPMD_RX_MAX_BURST && - rxq->nb_rx_desc % rxq->rx_free_thresh == 0) { - PMD_INIT_LOG(DEBUG, "Vector Rx can be enabled on this rxq."); - return true; - } - - PMD_INIT_LOG(DEBUG, "Vector Rx cannot be enabled on this rxq."); - return false; -} - static inline bool check_tx_vec_allow(struct ci_tx_queue *txq) { @@ -722,7 +709,7 @@ iavf_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, ad->rx_bulk_alloc_allowed = false; } - if (check_rx_vec_allow(rxq) == false) + if (!ci_rxq_vec_capable(rxq->nb_rx_desc, rxq->rx_free_thresh, rxq->offloads)) ad->rx_vec_allowed = false; #if defined RTE_ARCH_X86 || defined RTE_ARCH_ARM diff --git a/drivers/net/iavf/iavf_rxtx.h b/drivers/net/iavf/iavf_rxtx.h index c18e01560c..774c5c3574 100644 --- a/drivers/net/iavf/iavf_rxtx.h +++ b/drivers/net/iavf/iavf_rxtx.h @@ -5,6 +5,7 @@ #ifndef _IAVF_RXTX_H_ #define _IAVF_RXTX_H_ +#include <_common_intel/rx.h> #include <_common_intel/tx.h> /* In QLEN must be whole number of 32 descriptors. */ diff --git a/drivers/net/ice/ice_rxtx_vec_common.h b/drivers/net/ice/ice_rxtx_vec_common.h index d5cf0e6fca..331741e6b0 100644 --- a/drivers/net/ice/ice_rxtx_vec_common.h +++ b/drivers/net/ice/ice_rxtx_vec_common.h @@ -88,24 +88,12 @@ ice_rx_vec_queue_default(struct ice_rx_queue *rxq) if (!rxq) return -1; - if (!rte_is_power_of_2(rxq->nb_rx_desc)) - return -1; - - if (rxq->rx_free_thresh < ICE_VPMD_RX_BURST) - return -1; - - if (rxq->nb_rx_desc % rxq->rx_free_thresh) + if (!ci_rxq_vec_capable(rxq->nb_rx_desc, rxq->rx_free_thresh, rxq->offloads)) return -1; if (rxq->proto_xtr != PROTO_XTR_NONE) return -1; - if (rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) - return -1; - - if (rxq->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) - return -1; - if (rxq->offloads & ICE_RX_VECTOR_OFFLOAD) return ICE_VECTOR_OFFLOAD_PATH; diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h b/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h index 4a4d793e20..0703d5eecf 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h +++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h @@ -168,6 +168,13 @@ ixgbe_rx_vec_dev_conf_condition_check_default(struct rte_eth_dev *dev) if (fconf->mode != RTE_FDIR_MODE_NONE) return -1; + for (uint16_t i = 0; i < dev->data->nb_rx_queues; i++) { + struct ixgbe_rx_queue *rxq = dev->data->rx_queues[i]; + if (!rxq) + continue; + if (!ci_rxq_vec_capable(rxq->nb_rx_desc, rxq->rx_free_thresh, rxq->offloads)) + return -1; + } return 0; #else RTE_SET_USED(dev); -- 2.43.0