From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id D9479A0A0A;
	Sat,  8 May 2021 03:20:44 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 799CB40140;
	Sat,  8 May 2021 03:20:44 +0200 (CEST)
Received: from mga06.intel.com (mga06.intel.com [134.134.136.31])
 by mails.dpdk.org (Postfix) with ESMTP id 1D6224013F;
 Sat,  8 May 2021 03:20:41 +0200 (CEST)
IronPort-SDR: jxxM7N3l8kO15V5v8jVD7l3bg4FBdI6cUoiRaeUOhgnlyD1bFBd6H+Vgp9v7DZL0VkSt27BFSE
 AzNbrocidiXQ==
X-IronPort-AV: E=McAfee;i="6200,9189,9977"; a="260119441"
X-IronPort-AV: E=Sophos;i="5.82,282,1613462400"; d="scan'208";a="260119441"
Received: from fmsmga004.fm.intel.com ([10.253.24.48])
 by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 07 May 2021 18:20:39 -0700
IronPort-SDR: TCZbjAZPXCxxXPwZG8VBXkcf+aHTrsvsOo8LZsT7bsj5Kzq2y1F38RKrt8kDMVkJc+jaZaf+YL
 HRtJ9zk+hEDg==
X-IronPort-AV: E=Sophos;i="5.82,282,1613462400"; d="scan'208";a="453304954"
Received: from shwdenpg235.ccr.corp.intel.com ([10.240.182.60])
 by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 07 May 2021 18:20:37 -0700
From: Alvin Zhang <alvinx.zhang@intel.com>
To: qi.z.zhang@intel.com,
	ferruh.yigit@intel.com
Cc: dev@dpdk.org,
	Alvin Zhang <alvinx.zhang@intel.com>,
	stable@dpdk.org
Date: Sat,  8 May 2021 09:20:32 +0800
Message-Id: <20210508012032.14860-1-alvinx.zhang@intel.com>
X-Mailer: git-send-email 2.21.0.windows.1
In-Reply-To: <20210425092639.1428-1-alvinx.zhang@intel.com>
References: <20210425092639.1428-1-alvinx.zhang@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH v2] net/ice: fix txq vector path selection
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

If Tx vector mode is disabled, the txq vector mode should be
disabled too.

This patch adds checking of Tx vector mode before enabling txq
vector mode.

Fixes: 28f9002ab67f ("net/ice: add Tx AVX512 offload path")
Cc: stable@dpdk.org

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
---

v2: Update commit log.
---
 drivers/net/ice/ice_rxtx.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 92fbbc1..49abcb2 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -3303,13 +3303,6 @@
 		if (tx_check_ret >= 0 &&
 		    rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
 			ad->tx_vec_allowed = true;
-			for (i = 0; i < dev->data->nb_tx_queues; i++) {
-				txq = dev->data->tx_queues[i];
-				if (txq && ice_txq_vec_setup(txq)) {
-					ad->tx_vec_allowed = false;
-					break;
-				}
-			}
 
 			if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_512 &&
 			rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1 &&
@@ -3329,6 +3322,15 @@
 			if (!use_avx512 && tx_check_ret == ICE_VECTOR_OFFLOAD_PATH)
 				ad->tx_vec_allowed = false;
 
+			if (ad->tx_vec_allowed) {
+				for (i = 0; i < dev->data->nb_tx_queues; i++) {
+					txq = dev->data->tx_queues[i];
+					if (txq && ice_txq_vec_setup(txq)) {
+						ad->tx_vec_allowed = false;
+						break;
+					}
+				}
+			}
 		} else {
 			ad->tx_vec_allowed = false;
 		}
-- 
1.8.3.1