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 A19204612D; Fri, 24 Jan 2025 17:32:44 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D7D9542E4E; Fri, 24 Jan 2025 17:30:30 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by mails.dpdk.org (Postfix) with ESMTP id 9E92142E4E for ; Fri, 24 Jan 2025 17:30:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737736229; x=1769272229; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=t9TqEF98qqlm4mxF74R3wGfWdHUBQihm65fCY/wqwF8=; b=cHrpMltGzq+wNZhYtVgKc7v5Ok8fcSflT3eSFviPyOR51KJzfk8KQdtA K+6zB7hTg8OMqhooHB3XaRKOOCRrjWsMcXHtmUL4bvXkmyEXiR/tE2tQe l1cqnxdPKGiUIFo7/KcOuW7tM5xhjuyOj+qJF5EFABOcdCiBNFn0BoPww qPLSd+bh7oXkLINZsow4vQo2w9PL7QDXK8lWIxdXQZ9paucNsWRn+b0vZ /FUaee+txRiysO1oQdT81TuZE8cV9SoxZmFCHYpqkY8ax3hNucdRU9khs wXvEbrJ4ouoacwK2iJ4TppxcPafKKJTPZzi51NALBoIePDL5IxUv2AXi2 w==; X-CSE-ConnectionGUID: IjTlzuCEQS+mun8oy1+rpQ== X-CSE-MsgGUID: zfgwAQBSTYio/xJ6CEsr9g== X-IronPort-AV: E=McAfee;i="6700,10204,11325"; a="60740290" X-IronPort-AV: E=Sophos;i="6.13,231,1732608000"; d="scan'208";a="60740290" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2025 08:30:28 -0800 X-CSE-ConnectionGUID: 51W4wyA1R5OjW2N+DlMSfw== X-CSE-MsgGUID: FhpAy1BiTjyYskq7daCeEQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,231,1732608000"; d="scan'208";a="108352924" Received: from silpixa00401197coob.ir.intel.com (HELO silpixa00401385.ir.intel.com) ([10.237.214.45]) by fmviesa010.fm.intel.com with ESMTP; 24 Jan 2025 08:30:26 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: david.marchand@redhat.com, anatoly.burakov@intel.com, vladimir.medvedkin@intel.com, ian.stokes@intel.com, praveen.shetty@intel.com, Bruce Richardson Subject: [PATCH v6 25/25] net/intel: extract common Rx vector criteria Date: Fri, 24 Jan 2025 16:29:20 +0000 Message-ID: <20250124162921.1406103-26-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250124162921.1406103-1-bruce.richardson@intel.com> References: <20241122125418.2857301-1-bruce.richardson@intel.com> <20250124162921.1406103-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 80ea38369b..c48c98e5e6 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