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 C2836A0547 for ; Mon, 24 May 2021 11:02:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B655B4003C; Mon, 24 May 2021 11:02:57 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 2CF444003C for ; Mon, 24 May 2021 11:02:55 +0200 (CEST) IronPort-SDR: h+NPzqWd9IlViuvXmW1dIuKwt+ly9DuakzUQqK9ME1cfqgzKMkziPfs94BpSvHfwePmyfp4qNU I9CeL3k/UQvg== X-IronPort-AV: E=McAfee;i="6200,9189,9993"; a="263099942" X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208";a="263099942" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 May 2021 02:02:51 -0700 IronPort-SDR: IRxA7U0o6AhBT/jO0JAyPBnTQvjl+XVYSx8/+dZR/tckWBo4b9dk5PRLMZR+RR2XTGIImF710s 3N4y7cBNN3Dg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208";a="478437834" Received: from dpdk51.sh.intel.com ([10.67.111.142]) by fmsmga002.fm.intel.com with ESMTP; 24 May 2021 02:02:49 -0700 From: Qi Zhang To: qiming.yang@intel.com Cc: liheng.zhang@intel.com, yixue.wang@intel.com, yao.dong@intel.com, Qi Zhang , stable@dpdk.org Date: Mon, 24 May 2021 17:06:08 +0800 Message-Id: <20210524090608.980484-1-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH] net/ice: fix wrong data path selection in secondary process X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" The flag use_avx2 and use_avx512 are defined as local variables, they will not be aware by the secondary process, then wrong data path is selected. Fix the issue by moving them into struct ice_adapter. Fixes: ae60d3c9b227 ("net/ice: support Rx AVX2 vector") Fixes: 2d5f6953d56d ("net/ice: support vector AVX2 in Tx") Fixes: 7f85d5ebcfe1 ("net/ice: add AVX512 vector path") Cc: stable@dpdk.org Reported-by: Yixue Wang Signed-off-by: Qi Zhang --- drivers/net/ice/ice_ethdev.h | 6 +++++ drivers/net/ice/ice_rxtx.c | 44 ++++++++++++++++++------------------ 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index 2a8a8169d5..aebfd1b0b7 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -487,6 +487,12 @@ struct ice_adapter { struct ice_devargs devargs; enum ice_pkg_type active_pkg_type; /* loaded ddp package type */ uint16_t fdir_ref_cnt; +#ifdef RTE_ARCH_X86 + bool rx_use_avx2; + bool rx_use_avx512; + bool tx_use_avx2; + bool tx_use_avx512; +#endif }; struct ice_vsi_vlan_pvid_info { diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 49abcb2f5c..f4f6f48d78 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -3058,11 +3058,11 @@ ice_set_rx_function(struct rte_eth_dev *dev) #ifdef RTE_ARCH_X86 struct ice_rx_queue *rxq; int i; - int rx_check_ret; - bool use_avx512 = false; - bool use_avx2 = false; + int rx_check_ret = 0; if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + ad->rx_use_avx512 = false; + ad->rx_use_avx2 = false; rx_check_ret = ice_rx_vec_dev_check(dev); if (rx_check_ret >= 0 && ad->rx_bulk_alloc_allowed && rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) { @@ -3079,16 +3079,16 @@ ice_set_rx_function(struct rte_eth_dev *dev) rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1 && rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512BW) == 1) #ifdef CC_AVX512_SUPPORT - use_avx512 = true; + ad->rx_use_avx512 = true; #else PMD_DRV_LOG(NOTICE, "AVX512 is not supported in build env"); #endif - if (!use_avx512 && + if (!ad->rx_use_avx512 && (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) == 1 || rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1) && rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_256) - use_avx2 = true; + ad->rx_use_avx2 = true; } else { ad->rx_vec_allowed = false; @@ -3097,7 +3097,7 @@ ice_set_rx_function(struct rte_eth_dev *dev) if (ad->rx_vec_allowed) { if (dev->data->scattered_rx) { - if (use_avx512) { + if (ad->rx_use_avx512) { #ifdef CC_AVX512_SUPPORT if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) { PMD_DRV_LOG(NOTICE, @@ -3116,14 +3116,14 @@ ice_set_rx_function(struct rte_eth_dev *dev) } else { PMD_DRV_LOG(DEBUG, "Using %sVector Scattered Rx (port %d).", - use_avx2 ? "avx2 " : "", + ad->rx_use_avx2 ? "avx2 " : "", dev->data->port_id); - dev->rx_pkt_burst = use_avx2 ? + dev->rx_pkt_burst = ad->rx_use_avx2 ? ice_recv_scattered_pkts_vec_avx2 : ice_recv_scattered_pkts_vec; } } else { - if (use_avx512) { + if (ad->rx_use_avx512) { #ifdef CC_AVX512_SUPPORT if (rx_check_ret == ICE_VECTOR_OFFLOAD_PATH) { PMD_DRV_LOG(NOTICE, @@ -3142,9 +3142,9 @@ ice_set_rx_function(struct rte_eth_dev *dev) } else { PMD_DRV_LOG(DEBUG, "Using %sVector Rx (port %d).", - use_avx2 ? "avx2 " : "", + ad->rx_use_avx2 ? "avx2 " : "", dev->data->port_id); - dev->rx_pkt_burst = use_avx2 ? + dev->rx_pkt_burst = ad->rx_use_avx2 ? ice_recv_pkts_vec_avx2 : ice_recv_pkts_vec; } @@ -3294,11 +3294,11 @@ ice_set_tx_function(struct rte_eth_dev *dev) #ifdef RTE_ARCH_X86 struct ice_tx_queue *txq; int i; - int tx_check_ret; - bool use_avx512 = false; - bool use_avx2 = false; + int tx_check_ret = 0; if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + ad->tx_use_avx2 = false; + ad->tx_use_avx512 = false; tx_check_ret = ice_tx_vec_dev_check(dev); if (tx_check_ret >= 0 && rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) { @@ -3308,18 +3308,18 @@ ice_set_tx_function(struct rte_eth_dev *dev) rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1 && rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512BW) == 1) #ifdef CC_AVX512_SUPPORT - use_avx512 = true; + ad->tx_use_avx512 = true; #else PMD_DRV_LOG(NOTICE, "AVX512 is not supported in build env"); #endif - if (!use_avx512 && tx_check_ret == ICE_VECTOR_PATH && + if (!ad->tx_use_avx512 && tx_check_ret == ICE_VECTOR_PATH && (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2) == 1 || rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F) == 1) && rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_256) - use_avx2 = true; + ad->tx_use_avx2 = true; - if (!use_avx512 && tx_check_ret == ICE_VECTOR_OFFLOAD_PATH) + if (!ad->tx_use_avx512 && tx_check_ret == ICE_VECTOR_OFFLOAD_PATH) ad->tx_vec_allowed = false; if (ad->tx_vec_allowed) { @@ -3337,7 +3337,7 @@ ice_set_tx_function(struct rte_eth_dev *dev) } if (ad->tx_vec_allowed) { - if (use_avx512) { + if (ad->tx_use_avx512) { #ifdef CC_AVX512_SUPPORT if (tx_check_ret == ICE_VECTOR_OFFLOAD_PATH) { PMD_DRV_LOG(NOTICE, @@ -3354,9 +3354,9 @@ ice_set_tx_function(struct rte_eth_dev *dev) #endif } else { PMD_DRV_LOG(DEBUG, "Using %sVector Tx (port %d).", - use_avx2 ? "avx2 " : "", + ad->tx_use_avx2 ? "avx2 " : "", dev->data->port_id); - dev->tx_pkt_burst = use_avx2 ? + dev->tx_pkt_burst = ad->tx_use_avx2 ? ice_xmit_pkts_vec_avx2 : ice_xmit_pkts_vec; } -- 2.26.2