34 #ifndef _VIRTIO_NET_H_
35 #define _VIRTIO_NET_H_
43 #include <linux/vhost.h>
44 #include <linux/virtio_ring.h>
45 #include <linux/virtio_net.h>
46 #include <sys/eventfd.h>
47 #include <sys/socket.h>
56 #define VHOST_MEMORY_MAX_NREGIONS 8
59 #define VIRTIO_DEV_RUNNING 1
62 #define VIRTIO_DEV_STOPPED -1
66 enum {VIRTIO_RXQ, VIRTIO_TXQ, VIRTIO_QNUM};
68 #define BUF_VECTOR_MAX 256
92 #define VIRTIO_INVALID_EVENTFD (-1)
93 #define VIRTIO_UNINITIALIZED_EVENTFD (-2)
103 #ifndef VIRTIO_NET_F_GUEST_ANNOUNCE
104 #define VIRTIO_NET_F_GUEST_ANNOUNCE 21
114 #ifdef VIRTIO_NET_F_MQ
115 #define VHOST_MAX_QUEUE_PAIRS VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX
116 #define VHOST_SUPPORTS_MQ (1ULL << VIRTIO_NET_F_MQ)
118 #define VHOST_MAX_QUEUE_PAIRS 1
119 #define VHOST_SUPPORTS_MQ 0
125 #ifndef VIRTIO_F_VERSION_1
126 #define VIRTIO_F_VERSION_1 32
138 #define IF_NAME_SZ (PATH_MAX > IFNAMSIZ ? PATH_MAX : IFNAMSIZ)
187 static inline uint16_t __attribute__((always_inline))
188 rte_vring_available_entries(struct
virtio_net *dev, uint16_t queue_id)
202 static inline uint64_t __attribute__((always_inline))
207 uint64_t vhost_va = 0;
209 for (regionidx = 0; regionidx < dev->mem->nregions; regionidx++) {
210 region = &dev->mem->regions[regionidx];
232 uint64_t rte_vhost_feature_get(
void);
234 int rte_vhost_enable_guest_notification(
struct virtio_net *dev, uint16_t queue_id,
int enable);
237 int rte_vhost_driver_register(
const char *dev_name);
240 int rte_vhost_driver_unregister(
const char *dev_name);
245 int rte_vhost_driver_session_start(
void);
264 struct rte_mbuf **pkts, uint16_t count);