patches for DPDK stable branches
 help / color / mirror / Atom feed
From: "Min Hu (Connor)" <humin29@huawei.com>
To: <stable@dpdk.org>
Cc: <ferruh.yigit@intel.com>, <xuemingl@nvidia.com>
Subject: [dpdk-stable] [PATCH 20.11 4/4] net/hns3: fix verification of NEON support
Date: Mon, 17 May 2021 21:50:45 +0800	[thread overview]
Message-ID: <1621259445-5182-4-git-send-email-humin29@huawei.com> (raw)
In-Reply-To: <1621259445-5182-1-git-send-email-humin29@huawei.com>

From: Chengwen Feng <fengchengwen@huawei.com>

[ 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 <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 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 <rte_io.h>
 #include <rte_net.h>
 #include <rte_malloc.h>
-#if defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_SVE)
+#if defined(RTE_ARCH_ARM64)
 #include <rte_cpuflags.h>
 #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


  parent reply	other threads:[~2021-05-17 13:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-17 13:50 [dpdk-stable] [PATCH 20.11 1/4] net/hns3: fix possible mismatched response of mailbox Min Hu (Connor)
2021-05-17 13:50 ` [dpdk-stable] [PATCH 20.11 2/4] net/hns3: fix VF handling LSC event in secondary process Min Hu (Connor)
2021-05-18  4:15   ` Xueming(Steven) Li
2021-05-17 13:50 ` [dpdk-stable] [PATCH 20.11 3/4] net/hns3: fix timing in mailbox Min Hu (Connor)
2021-05-18  4:27   ` Xueming(Steven) Li
2021-05-17 13:50 ` Min Hu (Connor) [this message]
2021-05-18  4:27   ` [dpdk-stable] [PATCH 20.11 4/4] net/hns3: fix verification of NEON support Xueming(Steven) Li
2021-05-18  4:14 ` [dpdk-stable] [PATCH 20.11 1/4] net/hns3: fix possible mismatched response of mailbox Xueming(Steven) Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1621259445-5182-4-git-send-email-humin29@huawei.com \
    --to=humin29@huawei.com \
    --cc=ferruh.yigit@intel.com \
    --cc=stable@dpdk.org \
    --cc=xuemingl@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).