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 116E0A0597; Wed, 8 Apr 2020 03:18:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0945B1C02A; Wed, 8 Apr 2020 03:18:09 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 3226E1BFE8 for ; Wed, 8 Apr 2020 03:18:05 +0200 (CEST) IronPort-SDR: N0Y8Qo9T+aOuF+QC3Q20a5/Ra1SeG5uf4Rin8F739u4ttz8y7QPzEyXJESjk6CBu/eGxjXvB+8 mh5tyGkfEiuA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2020 18:18:04 -0700 IronPort-SDR: xDaZdClzPUf+iztya9XpFP2fs118/VNKd8f6zrNdeTkYeIt03vBubN8fnRY1FAbwyh/1yPCQHx wIgCeTv6ufTg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,357,1580803200"; d="scan'208";a="275288423" Received: from npg-dpdk-virtual-marvin-dev.sh.intel.com ([10.67.119.58]) by fmsmga004.fm.intel.com with ESMTP; 07 Apr 2020 18:18:02 -0700 From: Marvin Liu To: maxime.coquelin@redhat.com, xiaolong.ye@intel.com, zhihong.wang@intel.com Cc: harry.van.haaren@intel.com, dev@dpdk.org, Marvin Liu Date: Wed, 8 Apr 2020 16:53:08 +0800 Message-Id: <20200408085313.4487-3-yong.liu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200408085313.4487-1-yong.liu@intel.com> References: <20200313174230.74661-1-yong.liu@intel.com> <20200408085313.4487-1-yong.liu@intel.com> Subject: [dpdk-dev] [PATCH v3 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..399ac5511 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 = 0; + 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