From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id F2ECC1B31F for ; Mon, 6 Nov 2017 21:38:41 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 34B46C04AC5A; Mon, 6 Nov 2017 20:38:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 34B46C04AC5A Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=maxime.coquelin@redhat.com Received: from localhost.localdomain (ovpn-112-52.ams2.redhat.com [10.36.112.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 42D14512F7; Mon, 6 Nov 2017 20:38:37 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, yliu@fridaylinux.org, mark.b.kavanagh@intel.com, thomas@monjalon.net, ktraynor@redhat.com Cc: Maxime Coquelin Date: Mon, 6 Nov 2017 21:38:12 +0100 Message-Id: <20171106203812.18428-4-maxime.coquelin@redhat.com> In-Reply-To: <20171106203812.18428-1-maxime.coquelin@redhat.com> References: <20171103175735.24603-1-maxime.coquelin@redhat.com> <20171106203812.18428-1-maxime.coquelin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 06 Nov 2017 20:38:41 +0000 (UTC) Subject: [dpdk-dev] [PATCH v2 3/3] net: vhost: add iommu-support parameter to enable IOMMU feature 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: , X-List-Received-Date: Mon, 06 Nov 2017 20:38:42 -0000 Introduce a new iommu-support parameter to Vhost PMD that passes the RTE_VHOST_USER_IOMMU_SUPPORT flag at vhost device register time. Default value is 0, meaning that IOMMU support is disabled if not specified explicitly. Example to enable IOMMU support for a given device: --vdev 'net_vhost0,iface=/tmp/vhost-user2,iommu-support=1' Signed-off-by: Maxime Coquelin --- doc/guides/nics/vhost.rst | 5 +++++ drivers/net/vhost/rte_eth_vhost.c | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/doc/guides/nics/vhost.rst b/doc/guides/nics/vhost.rst index e651a1661..4f7ae8990 100644 --- a/doc/guides/nics/vhost.rst +++ b/doc/guides/nics/vhost.rst @@ -66,6 +66,11 @@ The user can specify below arguments in `--vdev` option. It is used to specify the number of queues virtio-net device has. (Default: 1) +#. ``iommu-support``: + + It is used to enable iommu support in vhost library. + (Default: 0 (disabled)) + Vhost PMD event handling ------------------------ diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index f98c98067..a28cc3b9a 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -52,6 +52,7 @@ enum {VIRTIO_RXQ, VIRTIO_TXQ, VIRTIO_QNUM}; #define ETH_VHOST_QUEUES_ARG "queues" #define ETH_VHOST_CLIENT_ARG "client" #define ETH_VHOST_DEQUEUE_ZERO_COPY "dequeue-zero-copy" +#define ETH_VHOST_IOMMU_SUPPORT "iommu-support" #define VHOST_MAX_PKT_BURST 32 static const char *valid_arguments[] = { @@ -59,6 +60,7 @@ static const char *valid_arguments[] = { ETH_VHOST_QUEUES_ARG, ETH_VHOST_CLIENT_ARG, ETH_VHOST_DEQUEUE_ZERO_COPY, + ETH_VHOST_IOMMU_SUPPORT, NULL }; @@ -1164,6 +1166,7 @@ rte_pmd_vhost_probe(struct rte_vdev_device *dev) uint64_t flags = 0; int client_mode = 0; int dequeue_zero_copy = 0; + int iommu_support = 0; RTE_LOG(INFO, PMD, "Initializing pmd_vhost for %s\n", rte_vdev_device_name(dev)); @@ -1211,6 +1214,16 @@ rte_pmd_vhost_probe(struct rte_vdev_device *dev) flags |= RTE_VHOST_USER_DEQUEUE_ZERO_COPY; } + if (rte_kvargs_count(kvlist, ETH_VHOST_IOMMU_SUPPORT) == 1) { + ret = rte_kvargs_process(kvlist, ETH_VHOST_IOMMU_SUPPORT, + &open_int, &iommu_support); + if (ret < 0) + goto out_free; + + if (iommu_support) + flags |= RTE_VHOST_USER_IOMMU_SUPPORT; + } + if (dev->device.numa_node == SOCKET_ID_ANY) dev->device.numa_node = rte_socket_id(); -- 2.13.6