net/virtio: add election for packed vector NEON path
authorJoyce Kong <joyce.kong@arm.com>
Tue, 17 Nov 2020 10:06:35 +0000 (18:06 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 8 Jan 2021 17:07:55 +0000 (18:07 +0100)
Add NEON vectorized path selection logic. Default setting comes from
vectorized devarg, then checks each criteria.

Packed ring vectorized neon path need:
    NEON is supported by compiler and host
    VERSION_1 and IN_ORDER features are negotiated
    mergeable feature is not negotiated
    LRO offloading is disabled

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
doc/guides/nics/virtio.rst
drivers/net/virtio/meson.build
drivers/net/virtio/virtio_ethdev.c
drivers/net/virtio/virtio_rxtx_packed.c
drivers/net/virtio/virtio_user_ethdev.c

index c03c2d0..b7be3ac 100644 (file)
@@ -483,11 +483,11 @@ according to below configuration:
 #. Packed virtqueue in-order non-mergeable path: If in-order feature is negotiated and
    Rx mergeable is not negotiated, this path will be selected.
 #. Packed virtqueue vectorized Rx path: If building and running environment support
-   AVX512 && in-order feature is negotiated && Rx mergeable is not negotiated &&
-   TCP_LRO Rx offloading is disabled && vectorized option enabled,
+   (AVX512 || NEON) && in-order feature is negotiated && Rx mergeable
+   is not negotiated && TCP_LRO Rx offloading is disabled && vectorized option enabled,
    this path will be selected.
 #. Packed virtqueue vectorized Tx path: If building and running environment support
-   AVX512 && in-order feature is negotiated && vectorized option enabled,
+   (AVX512 || NEON)  && in-order feature is negotiated && vectorized option enabled,
    this path will be selected.
 
 Rx/Tx callbacks of each Virtio path
index 01b8de6..738d667 100644 (file)
@@ -32,6 +32,7 @@ if arch_subdir == 'x86'
 elif arch_subdir == 'ppc'
        sources += files('virtio_rxtx_simple_altivec.c')
 elif arch_subdir == 'arm' and host_machine.cpu_family().startswith('aarch64')
+       sources += files('virtio_rxtx_packed.c')
        sources += files('virtio_rxtx_simple_neon.c')
 endif
 
index 6c233b7..54a6d6c 100644 (file)
@@ -1967,12 +1967,12 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
                if (!vtpci_packed_queue(hw)) {
                        hw->use_vec_rx = 1;
                } else {
-#if !defined(CC_AVX512_SUPPORT)
-                       PMD_DRV_LOG(INFO,
-                               "building environment do not support packed ring vectorized");
-#else
+#if defined(CC_AVX512_SUPPORT) || defined(RTE_ARCH_ARM)
                        hw->use_vec_rx = 1;
                        hw->use_vec_tx = 1;
+#else
+                       PMD_DRV_LOG(INFO,
+                               "building environment do not support packed ring vectorized");
 #endif
                }
        }
@@ -2320,6 +2320,17 @@ virtio_dev_configure(struct rte_eth_dev *dev)
                        hw->use_vec_rx = 0;
                        hw->use_vec_tx = 0;
                }
+#elif defined(RTE_ARCH_ARM)
+               if ((hw->use_vec_rx || hw->use_vec_tx) &&
+                   (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_NEON) ||
+                    !vtpci_with_feature(hw, VIRTIO_F_IN_ORDER) ||
+                    !vtpci_with_feature(hw, VIRTIO_F_VERSION_1) ||
+                    rte_vect_get_max_simd_bitwidth() < RTE_VECT_SIMD_128)) {
+                       PMD_DRV_LOG(INFO,
+                               "disabled packed ring vectorized path for requirements not met");
+                       hw->use_vec_rx = 0;
+                       hw->use_vec_tx = 0;
+               }
 #else
                hw->use_vec_rx = 0;
                hw->use_vec_tx = 0;
index 99d9a5a..882dca3 100644 (file)
@@ -18,6 +18,8 @@
 
 #ifdef CC_AVX512_SUPPORT
 #include "virtio_rxtx_packed_avx.h"
+#elif defined(RTE_ARCH_ARM)
+#include "virtio_rxtx_packed_neon.h"
 #endif
 
 uint16_t
index 4034519..241808c 100644 (file)
@@ -856,7 +856,7 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev)
 
        if (vectorized) {
                if (packed_vq) {
-#if defined(CC_AVX512_SUPPORT)
+#if defined(CC_AVX512_SUPPORT) || defined(RTE_ARCH_ARM)
                        hw->use_vec_rx = 1;
                        hw->use_vec_tx = 1;
 #else