14 #include <sys/eventfd.h>
24 #include <linux/vhost.h>
25 #include <linux/virtio_ring.h>
27 #define RTE_VHOST_USER_CLIENT (1ULL << 0)
28 #define RTE_VHOST_USER_NO_RECONNECT (1ULL << 1)
29 #define RTE_VHOST_USER_DEQUEUE_ZERO_COPY (1ULL << 2)
30 #define RTE_VHOST_USER_IOMMU_SUPPORT (1ULL << 3)
37 uint64_t guest_phys_addr;
38 uint64_t guest_user_addr;
39 uint64_t host_user_addr;
54 struct rte_vhost_vring {
55 struct vring_desc *desc;
56 struct vring_avail *avail;
57 struct vring_used *used;
58 uint64_t log_guest_addr;
84 int (*new_connection)(
int vid);
85 void (*destroy_connection)(
int vid);
112 for (i = 0; i < mem->nregions; i++) {
113 reg = &mem->regions[i];
114 if (gpa >= reg->guest_phys_addr &&
115 gpa < reg->guest_phys_addr + reg->size) {
116 return gpa - reg->guest_phys_addr +
142 uint64_t gpa, uint64_t *len)
147 for (i = 0; i < mem->nregions; i++) {
148 r = &mem->regions[i];
149 if (gpa >= r->guest_phys_addr &&
150 gpa < r->guest_phys_addr + r->size) {
152 if (
unlikely(*len > r->guest_phys_addr + r->size - gpa))
153 *len = r->guest_phys_addr + r->size - gpa;
155 return gpa - r->guest_phys_addr +
164 #define RTE_VHOST_NEED_LOG(features) ((features) & (1ULL << VHOST_F_LOG_ALL))
205 uint64_t offset, uint64_t len);
207 int rte_vhost_enable_guest_notification(
int vid, uint16_t queue_id,
int enable);
216 int rte_vhost_driver_unregister(
const char *path);
286 int rte_vhost_driver_callback_register(
const char *path,
405 struct rte_mbuf **pkts, uint16_t count);
456 struct rte_vhost_vring *vring);