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 1E283460C2; Mon, 20 Jan 2025 13:03:30 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A2B8242791; Mon, 20 Jan 2025 13:01:28 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by mails.dpdk.org (Postfix) with ESMTP id CCF144113C for ; Mon, 20 Jan 2025 13:01:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737374487; x=1768910487; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fCPuQqMGn4FczSkPbGU78FnD5ATUAzM6Q5GXFGfFeRs=; b=VsYIgGeyEHA/MRdNtqbOz/qmf3v5xaeDnuqJWSMcLfHnSQmXv2SuV3rR pa8iK7uOq5PFZX8XBy1G3pNlBXVU66cSMKrM4/nOF+ctKzN/Y1Qau3nUb 2IMnwP8wWcZDChlY+IckXyPE/D44YXhmtRyFVncD+1LWa1ZjtJt+ZCv8k ewlwqH/ztQb71zpp3r4b0gZGgzu5nU6sd4pwSqNRfLKIgI62w3Zu1cVbp Bwtbexu02pVQp1AyIQIM1zJ1n8XLCH6N9EIG+EDbwE1So6QvLptAUoxVs Sfu0ezF75SnMdjrWBwRwa/Fn8ENgwTv4JQ2r73vKGY4GOcqG2M620wv90 A==; X-CSE-ConnectionGUID: sOaN38vzQUeItB4pTl3Z4w== X-CSE-MsgGUID: sCWmNKvZSlyCyH5N6H1B2Q== X-IronPort-AV: E=McAfee;i="6700,10204,11320"; a="36979199" X-IronPort-AV: E=Sophos;i="6.13,219,1732608000"; d="scan'208";a="36979199" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jan 2025 04:01:26 -0800 X-CSE-ConnectionGUID: zI/lOoWcTM6toRP78uu98w== X-CSE-MsgGUID: l3Um9vRHQuSJx79r8hT3RQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="143767192" Received: from silpixa00401197coob.ir.intel.com (HELO silpixa00401385.ir.intel.com) ([10.237.214.45]) by orviesa001.jf.intel.com with ESMTP; 20 Jan 2025 04:01:25 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: david.marchand@redhat.com, Bruce Richardson , Ian Stokes , Vladimir Medvedkin , Anatoly Burakov Subject: [PATCH v5 25/25] net/intel/common: extract common Rx vector criteria Date: Mon, 20 Jan 2025 12:00:07 +0000 Message-ID: <20250120120016.1530274-26-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250120120016.1530274-1-bruce.richardson@intel.com> References: <20241122125418.2857301-1-bruce.richardson@intel.com> <20250120120016.1530274-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 intel/common 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/intel/common/rx.h | 20 +++++++++++ drivers/net/intel/i40e/i40e_rxtx_vec_common.h | 35 ++++--------------- drivers/net/intel/iavf/iavf_rxtx.c | 15 +------- drivers/net/intel/iavf/iavf_rxtx.h | 1 + drivers/net/intel/ice/ice_rxtx_vec_common.h | 14 +------- .../net/intel/ixgbe/ixgbe_rxtx_vec_common.h | 7 ++++ 6 files changed, 37 insertions(+), 55 deletions(-) diff --git a/drivers/net/intel/common/rx.h b/drivers/net/intel/common/rx.h index ca0485875c..abb01ba5e7 100644 --- a/drivers/net/intel/common/rx.h +++ b/drivers/net/intel/common/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/intel/i40e/i40e_rxtx_vec_common.h b/drivers/net/intel/i40e/i40e_rxtx_vec_common.h index 445aad3ca8..e499ae8dc7 100644 --- a/drivers/net/intel/i40e/i40e_rxtx_vec_common.h +++ b/drivers/net/intel/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/intel/iavf/iavf_rxtx.c b/drivers/net/intel/iavf/iavf_rxtx.c index 5b0cecdfb4..abf5566e3c 100644 --- a/drivers/net/intel/iavf/iavf_rxtx.c +++ b/drivers/net/intel/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/intel/iavf/iavf_rxtx.h b/drivers/net/intel/iavf/iavf_rxtx.h index b25b63d0c3..6a54b446cf 100644 --- a/drivers/net/intel/iavf/iavf_rxtx.h +++ b/drivers/net/intel/iavf/iavf_rxtx.h @@ -5,6 +5,7 @@ #ifndef _IAVF_RXTX_H_ #define _IAVF_RXTX_H_ +#include "../common/rx.h" #include "../common/tx.h" /* In QLEN must be whole number of 32 descriptors. */ diff --git a/drivers/net/intel/ice/ice_rxtx_vec_common.h b/drivers/net/intel/ice/ice_rxtx_vec_common.h index 2ea7ef8486..4c9c88ebe1 100644 --- a/drivers/net/intel/ice/ice_rxtx_vec_common.h +++ b/drivers/net/intel/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/intel/ixgbe/ixgbe_rxtx_vec_common.h b/drivers/net/intel/ixgbe/ixgbe_rxtx_vec_common.h index d9ff7fafe5..3768e99039 100644 --- a/drivers/net/intel/ixgbe/ixgbe_rxtx_vec_common.h +++ b/drivers/net/intel/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