[dpdk-stable] [PATCH 20.11 4/4] net/hns3: fix verification of NEON support
Xueming(Steven) Li
xuemingl at nvidia.com
Tue May 18 06:27:11 CEST 2021
Thanks, merged!
> -----Original Message-----
> From: Min Hu (Connor) <humin29 at huawei.com>
> Sent: Monday, May 17, 2021 9:51 PM
> To: stable at dpdk.org
> Cc: ferruh.yigit at intel.com; Xueming(Steven) Li <xuemingl at nvidia.com>
> Subject: [PATCH 20.11 4/4] net/hns3: fix verification of NEON support
>
> From: Chengwen Feng <fengchengwen at 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 at dpdk.org
>
> Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
> Signed-off-by: Min Hu (Connor) <humin29 at 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
More information about the stable
mailing list