The new virtio-transport=0|1 argument enables virtio-vhost-user support:

  testpmd ... --pci-whitelist 0000:00:04.0 \
              --vdev vhost,iface=0000:00:04.0,virtio-transport=1

Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/net/vhost/rte_eth_vhost.c 
b/drivers/net/vhost/rte_eth_vhost.c
index 2536ee4a2..a136ce89f 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -53,6 +53,7 @@ enum {VIRTIO_RXQ, VIRTIO_TXQ, VIRTIO_QNUM};
 #define ETH_VHOST_CLIENT_ARG           "client"
 #define ETH_VHOST_DEQUEUE_ZERO_COPY    "dequeue-zero-copy"
 #define ETH_VHOST_IOMMU_SUPPORT                "iommu-support"
+#define ETH_VHOST_VIRTIO_TRANSPORT     "virtio-transport"
 #define VHOST_MAX_PKT_BURST 32
 
 static const char *valid_arguments[] = {
@@ -61,6 +62,7 @@ static const char *valid_arguments[] = {
        ETH_VHOST_CLIENT_ARG,
        ETH_VHOST_DEQUEUE_ZERO_COPY,
        ETH_VHOST_IOMMU_SUPPORT,
+       ETH_VHOST_VIRTIO_TRANSPORT,
        NULL
 };
 
@@ -1167,6 +1169,7 @@ rte_pmd_vhost_probe(struct rte_vdev_device *dev)
        int client_mode = 0;
        int dequeue_zero_copy = 0;
        int iommu_support = 0;
+       uint16_t virtio_transport = 0;
 
        RTE_LOG(INFO, PMD, "Initializing pmd_vhost for %s\n",
                rte_vdev_device_name(dev));
@@ -1224,6 +1227,16 @@ rte_pmd_vhost_probe(struct rte_vdev_device *dev)
                        flags |= RTE_VHOST_USER_IOMMU_SUPPORT;
        }
 
+       if (rte_kvargs_count(kvlist, ETH_VHOST_VIRTIO_TRANSPORT) == 1) {
+               ret = rte_kvargs_process(kvlist, ETH_VHOST_VIRTIO_TRANSPORT,
+                                        &open_int, &virtio_transport);
+               if (ret < 0)
+                       goto out_free;
+
+               if (virtio_transport)
+                       flags |= RTE_VHOST_USER_VIRTIO_TRANSPORT;
+       }
+
        if (dev->device.numa_node == SOCKET_ID_ANY)
                dev->device.numa_node = rte_socket_id();
 
-- 
2.14.3

Reply via email to