bus/vdev: move code from EAL into a new driver
[dpdk.git] / drivers / net / vhost / rte_eth_vhost.c
index 3534649..2536ee4 100644 (file)
@@ -39,7 +39,7 @@
 #include <rte_ethdev_vdev.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
-#include <rte_vdev.h>
+#include <rte_bus_vdev.h>
 #include <rte_kvargs.h>
 #include <rte_vhost.h>
 #include <rte_spinlock.h>
@@ -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
 };
 
@@ -1086,8 +1088,7 @@ eth_dev_vhost_create(struct rte_vdev_device *dev, char *iface_name,
        internal->max_queues = queues;
        data->dev_link = pmd_link;
        data->mac_addrs = eth_addr;
-       data->dev_flags =
-               RTE_ETH_DEV_DETACHABLE | RTE_ETH_DEV_INTR_LSC;
+       data->dev_flags = RTE_ETH_DEV_INTR_LSC;
 
        eth_dev->dev_ops = &ops;
 
@@ -1165,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));
@@ -1212,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();