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 DAAB841BAB;
	Thu,  2 Feb 2023 11:21:25 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 162C642FC4;
	Thu,  2 Feb 2023 11:20:33 +0100 (CET)
Received: from mga07.intel.com (mga07.intel.com [134.134.136.100])
 by mails.dpdk.org (Postfix) with ESMTP id 8B72642FAE
 for <dev@dpdk.org>; Thu,  2 Feb 2023 11:20:31 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
 d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
 t=1675333231; x=1706869231;
 h=from:to:cc:subject:date:message-id:in-reply-to:
 references:mime-version:content-transfer-encoding;
 bh=sBxJgDB0vsAPeMvCthm47/J4GwA+8A9sOUk2eawfyVo=;
 b=eQVajUe6RClJv0Ri6YG0HAll99KRkZHNHJeKyCrwqlgKL4d0Md1PFedd
 sViBQTQ8XeuoZ6DDu5lRIvTOYSH9R/g191oeUG/FmPt1Q5Ia7DKaDqpek
 tZOUNyjIyC766YrDbjTxjS8QQk89C+OfPl3RpJ3VYXipNufJKqfQT/clO
 SGIJiJ8w7/C/7q5mXN9jKxlFfctSvB8jVesf4A13BlnBPfpt62Lj4dsuh
 N9EqZBPsiiL9nfFAqsbjPjmzNl59K3raOXb8zHy7vzkS8VsEX43SVXPPR
 vDjFwDHZqu2FQ9dYCKPyxRd6Sfq49UrpNdhr1l7c6eoT8Dc9zxnJMeAWt g==;
X-IronPort-AV: E=McAfee;i="6500,9779,10608"; a="392992408"
X-IronPort-AV: E=Sophos;i="5.97,267,1669104000"; d="scan'208";a="392992408"
Received: from fmsmga008.fm.intel.com ([10.253.24.58])
 by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 02 Feb 2023 02:20:31 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=McAfee;i="6500,9779,10608"; a="728808845"
X-IronPort-AV: E=Sophos;i="5.97,267,1669104000"; d="scan'208";a="728808845"
Received: from dpdk-beileix-3.sh.intel.com ([10.67.110.253])
 by fmsmga008.fm.intel.com with ESMTP; 02 Feb 2023 02:20:29 -0800
From: beilei.xing@intel.com
To: jingjing.wu@intel.com
Cc: dev@dpdk.org,
	qi.z.zhang@intel.com,
	Beilei Xing <beilei.xing@intel.com>
Subject: [PATCH v5 10/15] common/idpf: add vector flags in vport
Date: Thu,  2 Feb 2023 09:53:52 +0000
Message-Id: <20230202095357.37929-11-beilei.xing@intel.com>
X-Mailer: git-send-email 2.26.2
In-Reply-To: <20230202095357.37929-1-beilei.xing@intel.com>
References: <20230117080622.105657-1-beilei.xing@intel.com>
 <20230202095357.37929-1-beilei.xing@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 <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

From: Beilei Xing <beilei.xing@intel.com>

Move vector flags from idpf_adapter_ext structure to
idpf_vport structure.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
 drivers/common/idpf/idpf_common_device.h |  5 +++++
 drivers/net/idpf/idpf_ethdev.h           |  5 -----
 drivers/net/idpf/idpf_rxtx.c             | 22 ++++++++++------------
 3 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/drivers/common/idpf/idpf_common_device.h b/drivers/common/idpf/idpf_common_device.h
index 0c73d40e53..61c47ba5f4 100644
--- a/drivers/common/idpf/idpf_common_device.h
+++ b/drivers/common/idpf/idpf_common_device.h
@@ -103,6 +103,11 @@ struct idpf_vport {
 	uint16_t devarg_id;
 
 	bool stopped;
+
+	bool rx_vec_allowed;
+	bool tx_vec_allowed;
+	bool rx_use_avx512;
+	bool tx_use_avx512;
 };
 
 /* Message type read in virtual channel from PF */
diff --git a/drivers/net/idpf/idpf_ethdev.h b/drivers/net/idpf/idpf_ethdev.h
index c2a7abb05c..bef6199622 100644
--- a/drivers/net/idpf/idpf_ethdev.h
+++ b/drivers/net/idpf/idpf_ethdev.h
@@ -81,11 +81,6 @@ struct idpf_adapter_ext {
 
 	uint16_t used_vecs_num;
 
-	bool rx_vec_allowed;
-	bool tx_vec_allowed;
-	bool rx_use_avx512;
-	bool tx_use_avx512;
-
 	/* For PTP */
 	uint64_t time_hw;
 };
diff --git a/drivers/net/idpf/idpf_rxtx.c b/drivers/net/idpf/idpf_rxtx.c
index 0b10e4248b..068eb8000e 100644
--- a/drivers/net/idpf/idpf_rxtx.c
+++ b/drivers/net/idpf/idpf_rxtx.c
@@ -2221,25 +2221,24 @@ idpf_set_rx_function(struct rte_eth_dev *dev)
 {
 	struct idpf_vport *vport = dev->data->dev_private;
 #ifdef RTE_ARCH_X86
-	struct idpf_adapter_ext *ad = IDPF_ADAPTER_TO_EXT(vport->adapter);
 	struct idpf_rx_queue *rxq;
 	int i;
 
 	if (idpf_rx_vec_dev_check_default(dev) == IDPF_VECTOR_PATH &&
 	    rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
-		ad->rx_vec_allowed = true;
+		vport->rx_vec_allowed = true;
 
 		if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_512)
 #ifdef CC_AVX512_SUPPORT
 			if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1 &&
 			    rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512BW) == 1)
-				ad->rx_use_avx512 = true;
+				vport->rx_use_avx512 = true;
 #else
 		PMD_DRV_LOG(NOTICE,
 			    "AVX512 is not supported in build env");
 #endif /* CC_AVX512_SUPPORT */
 	} else {
-		ad->rx_vec_allowed = false;
+		vport->rx_vec_allowed = false;
 	}
 #endif /* RTE_ARCH_X86 */
 
@@ -2247,13 +2246,13 @@ idpf_set_rx_function(struct rte_eth_dev *dev)
 	if (vport->rxq_model == VIRTCHNL2_QUEUE_MODEL_SPLIT) {
 		dev->rx_pkt_burst = idpf_splitq_recv_pkts;
 	} else {
-		if (ad->rx_vec_allowed) {
+		if (vport->rx_vec_allowed) {
 			for (i = 0; i < dev->data->nb_tx_queues; i++) {
 				rxq = dev->data->rx_queues[i];
 				(void)idpf_singleq_rx_vec_setup(rxq);
 			}
 #ifdef CC_AVX512_SUPPORT
-			if (ad->rx_use_avx512) {
+			if (vport->rx_use_avx512) {
 				dev->rx_pkt_burst = idpf_singleq_recv_pkts_avx512;
 				return;
 			}
@@ -2275,7 +2274,6 @@ idpf_set_tx_function(struct rte_eth_dev *dev)
 {
 	struct idpf_vport *vport = dev->data->dev_private;
 #ifdef RTE_ARCH_X86
-	struct idpf_adapter_ext *ad = IDPF_ADAPTER_TO_EXT(vport->adapter);
 #ifdef CC_AVX512_SUPPORT
 	struct idpf_tx_queue *txq;
 	int i;
@@ -2283,18 +2281,18 @@ idpf_set_tx_function(struct rte_eth_dev *dev)
 
 	if (idpf_rx_vec_dev_check_default(dev) == IDPF_VECTOR_PATH &&
 	    rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
-		ad->tx_vec_allowed = true;
+		vport->tx_vec_allowed = true;
 		if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_512)
 #ifdef CC_AVX512_SUPPORT
 			if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1 &&
 			    rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512BW) == 1)
-				ad->tx_use_avx512 = true;
+				vport->tx_use_avx512 = true;
 #else
 		PMD_DRV_LOG(NOTICE,
 			    "AVX512 is not supported in build env");
 #endif /* CC_AVX512_SUPPORT */
 	} else {
-		ad->tx_vec_allowed = false;
+		vport->tx_vec_allowed = false;
 	}
 #endif /* RTE_ARCH_X86 */
 
@@ -2303,9 +2301,9 @@ idpf_set_tx_function(struct rte_eth_dev *dev)
 		dev->tx_pkt_prepare = idpf_prep_pkts;
 	} else {
 #ifdef RTE_ARCH_X86
-		if (ad->tx_vec_allowed) {
+		if (vport->tx_vec_allowed) {
 #ifdef CC_AVX512_SUPPORT
-			if (ad->tx_use_avx512) {
+			if (vport->tx_use_avx512) {
 				for (i = 0; i < dev->data->nb_tx_queues; i++) {
 					txq = dev->data->tx_queues[i];
 					if (txq == NULL)
-- 
2.26.2