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 19899A0A02 for ; Mon, 17 May 2021 15:50:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1125C4014E; Mon, 17 May 2021 15:50:56 +0200 (CEST) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mails.dpdk.org (Postfix) with ESMTP id 8C5F140F35 for ; Mon, 17 May 2021 15:50:53 +0200 (CEST) Received: from dggems705-chm.china.huawei.com (unknown [172.30.72.59]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FkL7B3HSzz17SL7; Mon, 17 May 2021 21:48:06 +0800 (CST) Received: from dggeme756-chm.china.huawei.com (10.3.19.102) by dggems705-chm.china.huawei.com (10.3.19.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Mon, 17 May 2021 21:50:50 +0800 Received: from localhost.localdomain (10.69.192.56) by dggeme756-chm.china.huawei.com (10.3.19.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Mon, 17 May 2021 21:50:50 +0800 From: "Min Hu (Connor)" To: CC: , Date: Mon, 17 May 2021 21:50:45 +0800 Message-ID: <1621259445-5182-4-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1621259445-5182-1-git-send-email-humin29@huawei.com> References: <1621259445-5182-1-git-send-email-humin29@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggeme756-chm.china.huawei.com (10.3.19.102) X-CFilter-Loop: Reflected Subject: [dpdk-stable] [PATCH 20.11 4/4] net/hns3: fix verification of NEON support 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" From: Chengwen Feng [ upstream commit e40ad6fca467b8671c7dfa7435b602997f5358e1 ] This patch adds verification of whether NEON supported. Fixes: a3d4f4d291d7 ("net/hns3: support NEON Rx") Fixes: e31f123db06b ("net/hns3: support NEON Tx") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Min Hu (Connor) --- drivers/net/hns3/hns3_rxtx.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c index 896567c..7a7d6ff 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c @@ -10,7 +10,7 @@ #include #include #include -#if defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_SVE) +#if defined(RTE_ARCH_ARM64) #include #endif @@ -2483,6 +2483,16 @@ hns3_rx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, } static bool +hns3_get_default_vec_support(void) +{ +#if defined(RTE_ARCH_ARM64) + if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_NEON)) + return true; +#endif + return false; +} + +static bool hns3_check_sve_support(void) { #if defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_SVE) @@ -2498,9 +2508,12 @@ hns3_get_rx_function(struct rte_eth_dev *dev) struct hns3_adapter *hns = dev->data->dev_private; uint64_t offloads = dev->data->dev_conf.rxmode.offloads; - if (hns->rx_vec_allowed && hns3_rx_check_vec_support(dev) == 0) - return hns3_check_sve_support() ? hns3_recv_pkts_vec_sve : - hns3_recv_pkts_vec; + if (hns->rx_vec_allowed && hns3_rx_check_vec_support(dev) == 0) { + if (hns3_get_default_vec_support()) + return hns3_recv_pkts_vec; + else if (hns3_check_sve_support()) + return hns3_recv_pkts_vec_sve; + } if (hns->rx_simple_allowed && !dev->data->scattered_rx && (offloads & DEV_RX_OFFLOAD_TCP_LRO) == 0) @@ -3734,8 +3747,10 @@ hns3_get_tx_function(struct rte_eth_dev *dev, eth_tx_prep_t *prep) if (hns->tx_vec_allowed && hns3_tx_check_vec_support(dev) == 0) { *prep = NULL; - return hns3_check_sve_support() ? hns3_xmit_pkts_vec_sve : - hns3_xmit_pkts_vec; + if (hns3_get_default_vec_support()) + return hns3_xmit_pkts_vec; + else if (hns3_check_sve_support()) + return hns3_xmit_pkts_vec_sve; } if (hns->tx_simple_allowed && -- 2.7.4