[dpdk-dev] [RFC 18/24] vhost: add RTE_VHOST_USER_VIRTIO_TRANSPORT flag
Stefan Hajnoczi
stefanha at redhat.com
Fri Jan 19 14:44:38 CET 2018
Extend the <rte_vhost.h> API to support the virtio-vhost-user transport
as an alternative to the AF_UNIX transport. The caller provides a PCI
DomBDF address:
rte_vhost_driver_register("0000:00:04.0",
RTE_VHOST_USER_VIRTIO_TRANSPORT);
Signed-off-by: Stefan Hajnoczi <stefanha at redhat.com>
---
drivers/librte_vhost/rte_vhost.h | 1 +
drivers/librte_vhost/socket.c | 3 +++
2 files changed, 4 insertions(+)
diff --git a/drivers/librte_vhost/rte_vhost.h b/drivers/librte_vhost/rte_vhost.h
index d33206997..d91d8d992 100644
--- a/drivers/librte_vhost/rte_vhost.h
+++ b/drivers/librte_vhost/rte_vhost.h
@@ -28,6 +28,7 @@ extern "C" {
#define RTE_VHOST_USER_NO_RECONNECT (1ULL << 1)
#define RTE_VHOST_USER_DEQUEUE_ZERO_COPY (1ULL << 2)
#define RTE_VHOST_USER_IOMMU_SUPPORT (1ULL << 3)
+#define RTE_VHOST_USER_VIRTIO_TRANSPORT (1ULL << 4)
/**
* Information relating to memory regions including offsets to
diff --git a/drivers/librte_vhost/socket.c b/drivers/librte_vhost/socket.c
index c46328950..265a014cf 100644
--- a/drivers/librte_vhost/socket.c
+++ b/drivers/librte_vhost/socket.c
@@ -132,6 +132,9 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
struct vhost_user_socket *vsocket;
const struct vhost_transport_ops *trans_ops = &af_unix_trans_ops;
+ if (flags & RTE_VHOST_USER_VIRTIO_TRANSPORT)
+ trans_ops = &virtio_vhost_user_trans_ops;
+
if (!path)
return -1;
--
2.14.3
More information about the dev
mailing list