From patchwork Tue May 1 14:13:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 39215 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5B32129D2; Tue, 1 May 2018 16:14:08 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 929BADED for ; Tue, 1 May 2018 16:14:06 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 May 2018 07:14:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,351,1520924400"; d="scan'208";a="195825893" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.223.223]) by orsmga004.jf.intel.com with ESMTP; 01 May 2018 07:14:03 -0700 From: Bruce Richardson To: Beilei Xing , Qi Zhang Cc: dev@dpdk.org, ferruh.yigit@intel.com, konstantin.ananyev@intel.com, Bruce Richardson Date: Tue, 1 May 2018 15:13:54 +0100 Message-Id: <20180501141354.13935-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180501130309.39444-1-bruce.richardson@intel.com> References: <20180501130309.39444-1-bruce.richardson@intel.com> Subject: [dpdk-dev] [PATCH v2] net/i40e: fix Tx fn selection when using new ethdev offloads X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The Tx function selection code in the driver only used the older txq flags values to check whether the scalar or vector functions should be used. This caused performance regressions with testpmd io-fwd as the scalar path rather than the vector one was being used in the default case. Fix this by changing the code to take account of new offloads and deleting the defines used for the old ones. Fixes: 7497d3e2f777 ("net/i40e: convert to new Tx offloads API") Signed-off-by: Bruce Richardson Reviewed-by: Ferruh Yigit --- drivers/net/i40e/i40e_rxtx.c | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index ec1ce54ca..006f5b846 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -40,9 +40,6 @@ /* Base address of the HW descriptor ring should be 128B aligned. */ #define I40E_RING_BASE_ALIGN 128 -#define I40E_SIMPLE_FLAGS ((uint32_t)ETH_TXQ_FLAGS_NOMULTSEGS | \ - ETH_TXQ_FLAGS_NOOFFLOADS) - #define I40E_TXD_CMD (I40E_TX_DESC_CMD_EOP | I40E_TX_DESC_CMD_RS) #ifdef RTE_LIBRTE_IEEE1588 @@ -2108,11 +2105,9 @@ i40e_dev_tx_queue_setup_runtime(struct rte_eth_dev *dev, dev->data->nb_tx_queues)) { /** * If it is the first queue to setup, - * set all flags to default and call + * set all flags and call * i40e_set_tx_function. */ - ad->tx_simple_allowed = true; - ad->tx_vec_allowed = true; i40e_set_tx_function_flag(dev, txq); i40e_set_tx_function(dev); return 0; @@ -2128,9 +2123,8 @@ i40e_dev_tx_queue_setup_runtime(struct rte_eth_dev *dev, } /* check simple tx conflict */ if (ad->tx_simple_allowed) { - if (((txq->txq_flags & I40E_SIMPLE_FLAGS) != - I40E_SIMPLE_FLAGS) || - txq->tx_rs_thresh < RTE_PMD_I40E_TX_MAX_BURST) { + if (txq->offloads != 0 || + txq->tx_rs_thresh < RTE_PMD_I40E_TX_MAX_BURST) { PMD_DRV_LOG(ERR, "No-simple tx is required."); return -EINVAL; } @@ -3080,18 +3074,21 @@ i40e_set_tx_function_flag(struct rte_eth_dev *dev, struct i40e_tx_queue *txq) I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); /* Use a simple Tx queue (no offloads, no multi segs) if possible */ - if (((txq->txq_flags & I40E_SIMPLE_FLAGS) == I40E_SIMPLE_FLAGS) - && (txq->tx_rs_thresh >= RTE_PMD_I40E_TX_MAX_BURST)) { - if (txq->tx_rs_thresh <= RTE_I40E_TX_MAX_FREE_BUF_SZ) { - PMD_INIT_LOG(DEBUG, "Vector tx" - " can be enabled on this txq."); - - } else { - ad->tx_vec_allowed = false; - } - } else { - ad->tx_simple_allowed = false; - } + ad->tx_simple_allowed = (txq->offloads == 0 && + txq->tx_rs_thresh >= RTE_PMD_I40E_TX_MAX_BURST); + ad->tx_vec_allowed = (ad->tx_simple_allowed && + txq->tx_rs_thresh <= RTE_I40E_TX_MAX_FREE_BUF_SZ); + + if (ad->tx_vec_allowed) + PMD_INIT_LOG(DEBUG, "Vector Tx can be enabled on Tx queue %u.", + txq->queue_id); + else if (ad->tx_simple_allowed) + PMD_INIT_LOG(DEBUG, "Simple Tx can be enabled on Tx queue %u.", + txq->queue_id); + else + PMD_INIT_LOG(DEBUG, + "Neither simple nor vector Tx enabled on Tx queue %u\n", + txq->queue_id); } void __attribute__((cold))