From patchwork Fri Sep 11 12:09:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joyce Kong X-Patchwork-Id: 77386 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 31F1FA04B5; Fri, 11 Sep 2020 14:09:45 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5F23F1C115; Fri, 11 Sep 2020 14:09:28 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 61AC91C115 for ; Fri, 11 Sep 2020 14:09:26 +0200 (CEST) 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 F10AA13A1; Fri, 11 Sep 2020 05:09:25 -0700 (PDT) Received: from net-arm-thunderx2-03.shanghai.arm.com (net-arm-thunderx2-03.shanghai.arm.com [10.169.210.123]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7C6043F68F; Fri, 11 Sep 2020 05:09:23 -0700 (PDT) From: Joyce Kong To: maxime.coquelin@redhat.com Cc: jerinj@marvell.com, dev@dpdk.org, nd@arm.com, honnappa.nagarahalli@arm.com, ruifeng.wang@arm.com, phil.yang@arm.com Date: Fri, 11 Sep 2020 20:09:06 +0800 Message-Id: <20200911120906.45995-4-joyce.kong@arm.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200911120906.45995-1-joyce.kong@arm.com> References: <20200911120906.45995-1-joyce.kong@arm.com> MIME-Version: 1.0 Subject: [dpdk-dev] [RFC 3/3] net/virtio: add election for packed vector Rx 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 --- doc/guides/nics/virtio.rst | 4 ++-- drivers/net/virtio/virtio_ethdev.c | 19 +++++++++++++++---- drivers/net/virtio/virtio_user_ethdev.c | 2 ++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/doc/guides/nics/virtio.rst b/doc/guides/nics/virtio.rst index 0daf25b22..fe9586699 100644 --- a/doc/guides/nics/virtio.rst +++ b/doc/guides/nics/virtio.rst @@ -483,8 +483,8 @@ 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 || ARCH_ARM || ARCH_ARM64) && 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, diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index dc0093bdf..b36ea98cf 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1958,12 +1958,14 @@ 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) hw->use_vec_rx = 1; hw->use_vec_tx = 1; +#elif defined(RTE_ARCH_ARM) || defined(RTE_ARCH_ARM64) + hw->use_vec_rx = 1; +#else + PMD_DRV_LOG(INFO, + "building environment do not support packed ring vectorized"); #endif } } @@ -2311,6 +2313,15 @@ virtio_dev_configure(struct rte_eth_dev *dev) hw->use_vec_rx = 0; hw->use_vec_tx = 0; } +#elif defined(RTE_ARCH_ARM) || defined(RTE_ARCH_ARM64) + if (hw->use_vec_rx && + (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_NEON) || + !vtpci_with_feature(hw, VIRTIO_F_IN_ORDER) || + !vtpci_with_feature(hw, VIRTIO_F_VERSION_1))) { + PMD_DRV_LOG(INFO, + "disabled packed ring vectorized path for requirements not met"); + hw->use_vec_rx = 0; + } #else hw->use_vec_rx = 0; hw->use_vec_tx = 0; diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 6003f6d50..1cfeb388f 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -766,6 +766,8 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev) #if defined(CC_AVX512_SUPPORT) hw->use_vec_rx = 1; hw->use_vec_tx = 1; +#elif defined(RTE_ARCH_ARM) || defined(RTE_ARCH_ARM64) + hw->use_vec_rx = 1; #else PMD_INIT_LOG(INFO, "building environment do not support packed ring vectorized");