From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 26B26A0589; Fri, 27 Mar 2020 10:18:32 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4DDF61C0C3; Fri, 27 Mar 2020 10:18:18 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id BFC151C0AD for ; Fri, 27 Mar 2020 10:18:11 +0100 (CET) IronPort-SDR: iEtqmbFxhZTTsaAV0U+H8l7bXHqTa5gcGiWtdy5VEkMeheJ4M56Jk65pdOy17OUaMPDJs4wpKE g7oD9zsNwtqg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2020 02:18:10 -0700 IronPort-SDR: qpBajI2fjIVVqCgClJhfdMs3l3WoLyCYJfBxk7qA0kCYyOKl413HJDvADI01e4dEeTC+lUAP6I 6waHPi2yDgaA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,311,1580803200"; d="scan'208";a="271507890" Received: from npg-dpdk-virtual-marvin-dev.sh.intel.com ([10.67.119.58]) by fmsmga004.fm.intel.com with ESMTP; 27 Mar 2020 02:18:09 -0700 From: Marvin Liu To: maxime.coquelin@redhat.com, xiaolong.ye@intel.com, zhihong.wang@intel.com Cc: dev@dpdk.org, Marvin Liu Date: Sat, 28 Mar 2020 00:54:07 +0800 Message-Id: <20200327165412.87359-3-yong.liu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200327165412.87359-1-yong.liu@intel.com> References: <20200313174230.74661-1-yong.liu@intel.com> <20200327165412.87359-1-yong.liu@intel.com> Subject: [dpdk-dev] [PATCH v2 2/7] net/virtio-user: add vectorized packed ring parameter 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 new parameter "packed_vec" which can disable vectorized packed ring datapath explicitly. When "packed_vec" option is on, driver will check packed ring vectorized datapath prerequisites. If any one of them not matched, vectorized datapath won't be selected. Signed-off-by: Marvin Liu diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h index 7433d2f08..8103b7a18 100644 --- a/drivers/net/virtio/virtio_pci.h +++ b/drivers/net/virtio/virtio_pci.h @@ -251,6 +251,8 @@ struct virtio_hw { uint8_t use_msix; uint8_t modern; uint8_t use_simple_rx; + uint8_t packed_vec_rx; + uint8_t packed_vec_tx; uint8_t use_inorder_rx; uint8_t use_inorder_tx; uint8_t weak_barriers; diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index e61af4068..2608b1fae 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -450,6 +450,8 @@ static const char *valid_args[] = { VIRTIO_USER_ARG_IN_ORDER, #define VIRTIO_USER_ARG_PACKED_VQ "packed_vq" VIRTIO_USER_ARG_PACKED_VQ, +#define VIRTIO_USER_ARG_PACKED_VEC "packed_vec" + VIRTIO_USER_ARG_PACKED_VEC, NULL }; @@ -552,6 +554,8 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev) uint64_t mrg_rxbuf = 1; uint64_t in_order = 1; uint64_t packed_vq = 0; + uint64_t packed_vec = 1; + char *path = NULL; char *ifname = NULL; char *mac_addr = NULL; @@ -668,6 +672,15 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev) } } + if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_PACKED_VEC) == 1) { + if (rte_kvargs_process(kvlist, VIRTIO_USER_ARG_PACKED_VEC, + &get_integer_arg, &packed_vec) < 0) { + PMD_INIT_LOG(ERR, "error to parse %s", + VIRTIO_USER_ARG_PACKED_VQ); + goto end; + } + } + if (queues > 1 && cq == 0) { PMD_INIT_LOG(ERR, "multi-q requires ctrl-q"); goto end; @@ -705,6 +718,17 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev) } hw = eth_dev->data->dev_private; +#if defined(RTE_ARCH_X86) && defined(CC_AVX512_SUPPORT) + if (packed_vec) { + hw->packed_vec_rx = 1; + hw->packed_vec_tx = 1; + } +#else + if (packed_vec) + PMD_INIT_LOG(ERR, "building environment not match vectorized " + "packed ring datapath requirement"); +#endif + if (virtio_user_dev_init(hw->virtio_user_dev, path, queues, cq, queue_size, mac_addr, &ifname, server_mode, mrg_rxbuf, in_order, packed_vq) < 0) { @@ -777,4 +801,5 @@ RTE_PMD_REGISTER_PARAM_STRING(net_virtio_user, "server=<0|1> " "mrg_rxbuf=<0|1> " "in_order=<0|1> " - "packed_vq=<0|1>"); + "packed_vq=<0|1>" + "packed_vec=<0|1>"); -- 2.17.1