From patchwork Tue Nov 17 10:06:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joyce Kong X-Patchwork-Id: 84262 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 67AFCA04DB; Tue, 17 Nov 2020 11:08:34 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C03FEC900; Tue, 17 Nov 2020 11:07:31 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 4D1DDC8DC for ; Tue, 17 Nov 2020 11:07:30 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C57A81478; Tue, 17 Nov 2020 02:07:28 -0800 (PST) Received: from net-arm-thunderx2-03.shanghai.arm.com (net-arm-thunderx2-03.shanghai.arm.com [10.169.208.206]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4E8F83F718; Tue, 17 Nov 2020 02:07:26 -0800 (PST) From: Joyce Kong To: maxime.coquelin@redhat.com, chenbo.xia@intel.com, jerinj@marvell.com, ruifeng.wang@arm.com, honnappa.nagarahalli@arm.com Cc: dev@dpdk.org, nd@arm.com Date: Tue, 17 Nov 2020 18:06:35 +0800 Message-Id: <20201117100635.27690-5-joyce.kong@arm.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201117100635.27690-1-joyce.kong@arm.com> References: <20200911120906.45995-1-joyce.kong@arm.com> <20201117100635.27690-1-joyce.kong@arm.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v1 4/4] net/virtio: add election for packed vector NEON path X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Reviewed-by: Ruifeng Wang Reviewed-by: Maxime Coquelin --- doc/guides/nics/virtio.rst | 6 +++--- drivers/net/virtio/meson.build | 1 + drivers/net/virtio/virtio_ethdev.c | 19 +++++++++++++++---- drivers/net/virtio/virtio_rxtx_packed.c | 2 ++ drivers/net/virtio/virtio_user_ethdev.c | 2 +- 5 files changed, 22 insertions(+), 8 deletions(-) diff --git a/doc/guides/nics/virtio.rst b/doc/guides/nics/virtio.rst index c03c2d0fe..b7be3aca1 100644 --- a/doc/guides/nics/virtio.rst +++ b/doc/guides/nics/virtio.rst @@ -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 diff --git a/drivers/net/virtio/meson.build b/drivers/net/virtio/meson.build index 01b8de6d4..738d66746 100644 --- a/drivers/net/virtio/meson.build +++ b/drivers/net/virtio/meson.build @@ -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 diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 6c233b75b..54a6d6ca9 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -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; diff --git a/drivers/net/virtio/virtio_rxtx_packed.c b/drivers/net/virtio/virtio_rxtx_packed.c index 99d9a5a99..882dca36e 100644 --- a/drivers/net/virtio/virtio_rxtx_packed.c +++ b/drivers/net/virtio/virtio_rxtx_packed.c @@ -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 diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 40345193e..241808cd8 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -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