34 #ifndef _VIRTIO_NET_H_
35 #define _VIRTIO_NET_H_
43 #include <linux/virtio_ring.h>
44 #include <linux/virtio_net.h>
45 #include <sys/eventfd.h>
46 #include <sys/socket.h>
54 #define VHOST_MEMORY_MAX_NREGIONS 8
57 #define VIRTIO_DEV_RUNNING 1
60 #define VIRTIO_DEV_STOPPED -1
64 enum {VIRTIO_RXQ, VIRTIO_TXQ, VIRTIO_QNUM};
66 #define BUF_VECTOR_MAX 256
104 #ifdef VIRTIO_NET_F_MQ
105 #define VHOST_MAX_QUEUE_PAIRS VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX
106 #define VHOST_SUPPORTS_MQ (1ULL << VIRTIO_NET_F_MQ)
108 #define VHOST_MAX_QUEUE_PAIRS 1
109 #define VHOST_SUPPORTS_MQ 0
115 #ifndef VIRTIO_F_VERSION_1
116 #define VIRTIO_F_VERSION_1 32
128 #define IF_NAME_SZ (PATH_MAX > IFNAMSIZ ? PATH_MAX : IFNAMSIZ)
173 static inline uint16_t __attribute__((always_inline))
174 rte_vring_available_entries(struct
virtio_net *dev, uint16_t queue_id)
188 static inline uint64_t __attribute__((always_inline))
193 uint64_t vhost_va = 0;
195 for (regionidx = 0; regionidx < dev->mem->nregions; regionidx++) {
196 region = &dev->mem->regions[regionidx];
217 uint64_t rte_vhost_feature_get(
void);
219 int rte_vhost_enable_guest_notification(
struct virtio_net *dev, uint16_t queue_id,
int enable);
222 int rte_vhost_driver_register(
const char *dev_name);
225 int rte_vhost_driver_unregister(
const char *dev_name);
230 int rte_vhost_driver_session_start(
void);
249 struct rte_mbuf **pkts, uint16_t count);