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: Nikos Dragazis <ndraga...@arrikto.com>
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 0b61e37..c0d087f 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -31,6 +31,7 @@ enum {VIRTIO_RXQ, VIRTIO_TXQ, VIRTIO_QNUM};
 #define ETH_VHOST_DEQUEUE_ZERO_COPY    "dequeue-zero-copy"
 #define ETH_VHOST_IOMMU_SUPPORT                "iommu-support"
 #define ETH_VHOST_POSTCOPY_SUPPORT     "postcopy-support"
+#define ETH_VHOST_VIRTIO_TRANSPORT     "virtio-transport"
 #define VHOST_MAX_PKT_BURST 32
 
 static const char *valid_arguments[] = {
@@ -40,6 +41,7 @@ static const char *valid_arguments[] = {
        ETH_VHOST_DEQUEUE_ZERO_COPY,
        ETH_VHOST_IOMMU_SUPPORT,
        ETH_VHOST_POSTCOPY_SUPPORT,
+       ETH_VHOST_VIRTIO_TRANSPORT,
        NULL
 };
 
@@ -1341,6 +1343,7 @@ rte_pmd_vhost_probe(struct rte_vdev_device *dev)
        int dequeue_zero_copy = 0;
        int iommu_support = 0;
        int postcopy_support = 0;
+       uint16_t virtio_transport = 0;
        struct rte_eth_dev *eth_dev;
        const char *name = rte_vdev_device_name(dev);
 
@@ -1422,6 +1425,16 @@ rte_pmd_vhost_probe(struct rte_vdev_device *dev)
                        flags |= RTE_VHOST_USER_POSTCOPY_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.7.4

Reply via email to