vhost: add virtio packed virtqueue defines
[dpdk.git] / lib / librte_vhost / vhost.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2018 Intel Corporation
3  */
4
5 #ifndef _VHOST_NET_CDEV_H_
6 #define _VHOST_NET_CDEV_H_
7 #include <stdint.h>
8 #include <stdio.h>
9 #include <stdbool.h>
10 #include <sys/types.h>
11 #include <sys/queue.h>
12 #include <unistd.h>
13 #include <linux/vhost.h>
14 #include <linux/virtio_net.h>
15 #include <sys/socket.h>
16 #include <linux/if.h>
17
18 #include <rte_log.h>
19 #include <rte_ether.h>
20 #include <rte_rwlock.h>
21
22 #include "rte_vhost.h"
23 #include "rte_vdpa.h"
24
25 /* Used to indicate that the device is running on a data core */
26 #define VIRTIO_DEV_RUNNING 1
27 /* Used to indicate that the device is ready to operate */
28 #define VIRTIO_DEV_READY 2
29 /* Used to indicate that the built-in vhost net device backend is enabled */
30 #define VIRTIO_DEV_BUILTIN_VIRTIO_NET 4
31 /* Used to indicate that the device has its own data path and configured */
32 #define VIRTIO_DEV_VDPA_CONFIGURED 8
33
34 /* Backend value set by guest. */
35 #define VIRTIO_DEV_STOPPED -1
36
37 #define BUF_VECTOR_MAX 256
38
39 #define VHOST_LOG_CACHE_NR 32
40
41 /**
42  * Structure contains buffer address, length and descriptor index
43  * from vring to do scatter RX.
44  */
45 struct buf_vector {
46         uint64_t buf_iova;
47         uint64_t buf_addr;
48         uint32_t buf_len;
49         uint32_t desc_idx;
50 };
51
52 /*
53  * A structure to hold some fields needed in zero copy code path,
54  * mainly for associating an mbuf with the right desc_idx.
55  */
56 struct zcopy_mbuf {
57         struct rte_mbuf *mbuf;
58         uint32_t desc_idx;
59         uint16_t in_use;
60
61         TAILQ_ENTRY(zcopy_mbuf) next;
62 };
63 TAILQ_HEAD(zcopy_mbuf_list, zcopy_mbuf);
64
65 /*
66  * Structure contains the info for each batched memory copy.
67  */
68 struct batch_copy_elem {
69         void *dst;
70         void *src;
71         uint32_t len;
72         uint64_t log_addr;
73 };
74
75 /*
76  * Structure that contains the info for batched dirty logging.
77  */
78 struct log_cache_entry {
79         uint32_t offset;
80         unsigned long val;
81 };
82
83 /**
84  * Structure contains variables relevant to RX/TX virtqueues.
85  */
86 struct vhost_virtqueue {
87         struct vring_desc       *desc;
88         struct vring_avail      *avail;
89         struct vring_used       *used;
90         uint32_t                size;
91
92         uint16_t                last_avail_idx;
93         uint16_t                last_used_idx;
94         /* Last used index we notify to front end. */
95         uint16_t                signalled_used;
96 #define VIRTIO_INVALID_EVENTFD          (-1)
97 #define VIRTIO_UNINITIALIZED_EVENTFD    (-2)
98
99         /* Backend value to determine if device should started/stopped */
100         int                     backend;
101         int                     enabled;
102         int                     access_ok;
103         rte_spinlock_t          access_lock;
104
105         /* Used to notify the guest (trigger interrupt) */
106         int                     callfd;
107         /* Currently unused as polling mode is enabled */
108         int                     kickfd;
109
110         /* Physical address of used ring, for logging */
111         uint64_t                log_guest_addr;
112
113         uint16_t                nr_zmbuf;
114         uint16_t                zmbuf_size;
115         uint16_t                last_zmbuf_idx;
116         struct zcopy_mbuf       *zmbufs;
117         struct zcopy_mbuf_list  zmbuf_list;
118
119         struct vring_used_elem  *shadow_used_ring;
120         uint16_t                shadow_used_idx;
121         struct vhost_vring_addr ring_addrs;
122
123         struct batch_copy_elem  *batch_copy_elems;
124         uint16_t                batch_copy_nb_elems;
125
126         struct log_cache_entry log_cache[VHOST_LOG_CACHE_NR];
127         uint16_t log_cache_nb_elem;
128
129         rte_rwlock_t    iotlb_lock;
130         rte_rwlock_t    iotlb_pending_lock;
131         struct rte_mempool *iotlb_pool;
132         TAILQ_HEAD(, vhost_iotlb_entry) iotlb_list;
133         int                             iotlb_cache_nr;
134         TAILQ_HEAD(, vhost_iotlb_entry) iotlb_pending_list;
135 } __rte_cache_aligned;
136
137 /* Old kernels have no such macros defined */
138 #ifndef VIRTIO_NET_F_GUEST_ANNOUNCE
139  #define VIRTIO_NET_F_GUEST_ANNOUNCE 21
140 #endif
141
142 #ifndef VIRTIO_NET_F_MQ
143  #define VIRTIO_NET_F_MQ                22
144 #endif
145
146 #define VHOST_MAX_VRING                 0x100
147 #define VHOST_MAX_QUEUE_PAIRS           0x80
148
149 #ifndef VIRTIO_NET_F_MTU
150  #define VIRTIO_NET_F_MTU 3
151 #endif
152
153 #ifndef VIRTIO_F_ANY_LAYOUT
154  #define VIRTIO_F_ANY_LAYOUT            27
155 #endif
156
157 /* Declare IOMMU related bits for older kernels */
158 #ifndef VIRTIO_F_IOMMU_PLATFORM
159
160 #define VIRTIO_F_IOMMU_PLATFORM 33
161
162 struct vhost_iotlb_msg {
163         __u64 iova;
164         __u64 size;
165         __u64 uaddr;
166 #define VHOST_ACCESS_RO      0x1
167 #define VHOST_ACCESS_WO      0x2
168 #define VHOST_ACCESS_RW      0x3
169         __u8 perm;
170 #define VHOST_IOTLB_MISS           1
171 #define VHOST_IOTLB_UPDATE         2
172 #define VHOST_IOTLB_INVALIDATE     3
173 #define VHOST_IOTLB_ACCESS_FAIL    4
174         __u8 type;
175 };
176
177 #define VHOST_IOTLB_MSG 0x1
178
179 struct vhost_msg {
180         int type;
181         union {
182                 struct vhost_iotlb_msg iotlb;
183                 __u8 padding[64];
184         };
185 };
186 #endif
187
188 /*
189  * Define virtio 1.0 for older kernels
190  */
191 #ifndef VIRTIO_F_VERSION_1
192  #define VIRTIO_F_VERSION_1 32
193 #endif
194
195 /* Declare packed ring related bits for older kernels */
196 #ifndef VIRTIO_F_RING_PACKED
197
198 #define VIRTIO_F_RING_PACKED 34
199
200 #define VRING_DESC_F_NEXT       1
201 #define VRING_DESC_F_WRITE      2
202 #define VRING_DESC_F_INDIRECT   4
203
204 #define VRING_DESC_F_AVAIL      (1ULL << 7)
205 #define VRING_DESC_F_USED       (1ULL << 15)
206
207 struct vring_packed_desc {
208         uint64_t addr;
209         uint32_t len;
210         uint16_t id;
211         uint16_t flags;
212 };
213 #endif
214
215 /*
216  * Available and used descs are in same order
217  */
218 #ifndef VIRTIO_F_IN_ORDER
219 #define VIRTIO_F_IN_ORDER      35
220 #endif
221
222 /* Features supported by this builtin vhost-user net driver. */
223 #define VIRTIO_NET_SUPPORTED_FEATURES ((1ULL << VIRTIO_NET_F_MRG_RXBUF) | \
224                                 (1ULL << VIRTIO_F_ANY_LAYOUT) | \
225                                 (1ULL << VIRTIO_NET_F_CTRL_VQ) | \
226                                 (1ULL << VIRTIO_NET_F_CTRL_RX) | \
227                                 (1ULL << VIRTIO_NET_F_GUEST_ANNOUNCE) | \
228                                 (1ULL << VIRTIO_NET_F_MQ)      | \
229                                 (1ULL << VIRTIO_F_VERSION_1)   | \
230                                 (1ULL << VHOST_F_LOG_ALL)      | \
231                                 (1ULL << VHOST_USER_F_PROTOCOL_FEATURES) | \
232                                 (1ULL << VIRTIO_NET_F_GSO) | \
233                                 (1ULL << VIRTIO_NET_F_HOST_TSO4) | \
234                                 (1ULL << VIRTIO_NET_F_HOST_TSO6) | \
235                                 (1ULL << VIRTIO_NET_F_HOST_UFO) | \
236                                 (1ULL << VIRTIO_NET_F_HOST_ECN) | \
237                                 (1ULL << VIRTIO_NET_F_CSUM)    | \
238                                 (1ULL << VIRTIO_NET_F_GUEST_CSUM) | \
239                                 (1ULL << VIRTIO_NET_F_GUEST_TSO4) | \
240                                 (1ULL << VIRTIO_NET_F_GUEST_TSO6) | \
241                                 (1ULL << VIRTIO_NET_F_GUEST_UFO) | \
242                                 (1ULL << VIRTIO_NET_F_GUEST_ECN) | \
243                                 (1ULL << VIRTIO_RING_F_INDIRECT_DESC) | \
244                                 (1ULL << VIRTIO_RING_F_EVENT_IDX) | \
245                                 (1ULL << VIRTIO_NET_F_MTU)  | \
246                                 (1ULL << VIRTIO_F_IN_ORDER) | \
247                                 (1ULL << VIRTIO_F_IOMMU_PLATFORM))
248
249
250 struct guest_page {
251         uint64_t guest_phys_addr;
252         uint64_t host_phys_addr;
253         uint64_t size;
254 };
255
256 /**
257  * function prototype for the vhost backend to handler specific vhost user
258  * messages prior to the master message handling
259  *
260  * @param vid
261  *  vhost device id
262  * @param msg
263  *  Message pointer.
264  * @param require_reply
265  *  If the handler requires sending a reply, this varaible shall be written 1,
266  *  otherwise 0.
267  * @param skip_master
268  *  If the handler requires skipping the master message handling, this variable
269  *  shall be written 1, otherwise 0.
270  * @return
271  *  0 on success, -1 on failure
272  */
273 typedef int (*vhost_msg_pre_handle)(int vid, void *msg,
274                 uint32_t *require_reply, uint32_t *skip_master);
275
276 /**
277  * function prototype for the vhost backend to handler specific vhost user
278  * messages after the master message handling is done
279  *
280  * @param vid
281  *  vhost device id
282  * @param msg
283  *  Message pointer.
284  * @param require_reply
285  *  If the handler requires sending a reply, this varaible shall be written 1,
286  *  otherwise 0.
287  * @return
288  *  0 on success, -1 on failure
289  */
290 typedef int (*vhost_msg_post_handle)(int vid, void *msg,
291                 uint32_t *require_reply);
292
293 /**
294  * pre and post vhost user message handlers
295  */
296 struct vhost_user_extern_ops {
297         vhost_msg_pre_handle pre_msg_handle;
298         vhost_msg_post_handle post_msg_handle;
299 };
300
301 /**
302  * Device structure contains all configuration information relating
303  * to the device.
304  */
305 struct virtio_net {
306         /* Frontend (QEMU) memory and memory region information */
307         struct rte_vhost_memory *mem;
308         uint64_t                features;
309         uint64_t                protocol_features;
310         int                     vid;
311         uint32_t                flags;
312         uint16_t                vhost_hlen;
313         /* to tell if we need broadcast rarp packet */
314         rte_atomic16_t          broadcast_rarp;
315         uint32_t                nr_vring;
316         int                     dequeue_zero_copy;
317         struct vhost_virtqueue  *virtqueue[VHOST_MAX_QUEUE_PAIRS * 2];
318 #define IF_NAME_SZ (PATH_MAX > IFNAMSIZ ? PATH_MAX : IFNAMSIZ)
319         char                    ifname[IF_NAME_SZ];
320         uint64_t                log_size;
321         uint64_t                log_base;
322         uint64_t                log_addr;
323         struct ether_addr       mac;
324         uint16_t                mtu;
325
326         struct vhost_device_ops const *notify_ops;
327
328         uint32_t                nr_guest_pages;
329         uint32_t                max_guest_pages;
330         struct guest_page       *guest_pages;
331
332         int                     slave_req_fd;
333         rte_spinlock_t          slave_req_lock;
334
335         /*
336          * Device id to identify a specific backend device.
337          * It's set to -1 for the default software implementation.
338          */
339         int                     vdpa_dev_id;
340
341         /* private data for virtio device */
342         void                    *extern_data;
343         /* pre and post vhost user message handlers for the device */
344         struct vhost_user_extern_ops extern_ops;
345 } __rte_cache_aligned;
346
347 #define VHOST_LOG_PAGE  4096
348
349 /*
350  * Atomically set a bit in memory.
351  */
352 static __rte_always_inline void
353 vhost_set_bit(unsigned int nr, volatile uint8_t *addr)
354 {
355 #if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION < 70100)
356         /*
357          * __sync_ built-ins are deprecated, but __atomic_ ones
358          * are sub-optimized in older GCC versions.
359          */
360         __sync_fetch_and_or_1(addr, (1U << nr));
361 #else
362         __atomic_fetch_or(addr, (1U << nr), __ATOMIC_RELAXED);
363 #endif
364 }
365
366 static __rte_always_inline void
367 vhost_log_page(uint8_t *log_base, uint64_t page)
368 {
369         vhost_set_bit(page % 8, &log_base[page / 8]);
370 }
371
372 static __rte_always_inline void
373 vhost_log_write(struct virtio_net *dev, uint64_t addr, uint64_t len)
374 {
375         uint64_t page;
376
377         if (likely(((dev->features & (1ULL << VHOST_F_LOG_ALL)) == 0) ||
378                    !dev->log_base || !len))
379                 return;
380
381         if (unlikely(dev->log_size <= ((addr + len - 1) / VHOST_LOG_PAGE / 8)))
382                 return;
383
384         /* To make sure guest memory updates are committed before logging */
385         rte_smp_wmb();
386
387         page = addr / VHOST_LOG_PAGE;
388         while (page * VHOST_LOG_PAGE < addr + len) {
389                 vhost_log_page((uint8_t *)(uintptr_t)dev->log_base, page);
390                 page += 1;
391         }
392 }
393
394 static __rte_always_inline void
395 vhost_log_cache_sync(struct virtio_net *dev, struct vhost_virtqueue *vq)
396 {
397         unsigned long *log_base;
398         int i;
399
400         if (likely(((dev->features & (1ULL << VHOST_F_LOG_ALL)) == 0) ||
401                    !dev->log_base))
402                 return;
403
404         log_base = (unsigned long *)(uintptr_t)dev->log_base;
405
406         /*
407          * It is expected a write memory barrier has been issued
408          * before this function is called.
409          */
410
411         for (i = 0; i < vq->log_cache_nb_elem; i++) {
412                 struct log_cache_entry *elem = vq->log_cache + i;
413
414 #if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION < 70100)
415                 /*
416                  * '__sync' builtins are deprecated, but '__atomic' ones
417                  * are sub-optimized in older GCC versions.
418                  */
419                 __sync_fetch_and_or(log_base + elem->offset, elem->val);
420 #else
421                 __atomic_fetch_or(log_base + elem->offset, elem->val,
422                                 __ATOMIC_RELAXED);
423 #endif
424         }
425
426         rte_smp_wmb();
427
428         vq->log_cache_nb_elem = 0;
429 }
430
431 static __rte_always_inline void
432 vhost_log_cache_page(struct virtio_net *dev, struct vhost_virtqueue *vq,
433                         uint64_t page)
434 {
435         uint32_t bit_nr = page % (sizeof(unsigned long) << 3);
436         uint32_t offset = page / (sizeof(unsigned long) << 3);
437         int i;
438
439         for (i = 0; i < vq->log_cache_nb_elem; i++) {
440                 struct log_cache_entry *elem = vq->log_cache + i;
441
442                 if (elem->offset == offset) {
443                         elem->val |= (1UL << bit_nr);
444                         return;
445                 }
446         }
447
448         if (unlikely(i >= VHOST_LOG_CACHE_NR)) {
449                 /*
450                  * No more room for a new log cache entry,
451                  * so write the dirty log map directly.
452                  */
453                 rte_smp_wmb();
454                 vhost_log_page((uint8_t *)(uintptr_t)dev->log_base, page);
455
456                 return;
457         }
458
459         vq->log_cache[i].offset = offset;
460         vq->log_cache[i].val = (1UL << bit_nr);
461         vq->log_cache_nb_elem++;
462 }
463
464 static __rte_always_inline void
465 vhost_log_cache_write(struct virtio_net *dev, struct vhost_virtqueue *vq,
466                         uint64_t addr, uint64_t len)
467 {
468         uint64_t page;
469
470         if (likely(((dev->features & (1ULL << VHOST_F_LOG_ALL)) == 0) ||
471                    !dev->log_base || !len))
472                 return;
473
474         if (unlikely(dev->log_size <= ((addr + len - 1) / VHOST_LOG_PAGE / 8)))
475                 return;
476
477         page = addr / VHOST_LOG_PAGE;
478         while (page * VHOST_LOG_PAGE < addr + len) {
479                 vhost_log_cache_page(dev, vq, page);
480                 page += 1;
481         }
482 }
483
484 static __rte_always_inline void
485 vhost_log_cache_used_vring(struct virtio_net *dev, struct vhost_virtqueue *vq,
486                         uint64_t offset, uint64_t len)
487 {
488         vhost_log_cache_write(dev, vq, vq->log_guest_addr + offset, len);
489 }
490
491 static __rte_always_inline void
492 vhost_log_used_vring(struct virtio_net *dev, struct vhost_virtqueue *vq,
493                      uint64_t offset, uint64_t len)
494 {
495         vhost_log_write(dev, vq->log_guest_addr + offset, len);
496 }
497
498 /* Macros for printing using RTE_LOG */
499 #define RTE_LOGTYPE_VHOST_CONFIG RTE_LOGTYPE_USER1
500 #define RTE_LOGTYPE_VHOST_DATA   RTE_LOGTYPE_USER1
501
502 #ifdef RTE_LIBRTE_VHOST_DEBUG
503 #define VHOST_MAX_PRINT_BUFF 6072
504 #define VHOST_LOG_DEBUG(log_type, fmt, args...) \
505         RTE_LOG(DEBUG, log_type, fmt, ##args)
506 #define PRINT_PACKET(device, addr, size, header) do { \
507         char *pkt_addr = (char *)(addr); \
508         unsigned int index; \
509         char packet[VHOST_MAX_PRINT_BUFF]; \
510         \
511         if ((header)) \
512                 snprintf(packet, VHOST_MAX_PRINT_BUFF, "(%d) Header size %d: ", (device->vid), (size)); \
513         else \
514                 snprintf(packet, VHOST_MAX_PRINT_BUFF, "(%d) Packet size %d: ", (device->vid), (size)); \
515         for (index = 0; index < (size); index++) { \
516                 snprintf(packet + strnlen(packet, VHOST_MAX_PRINT_BUFF), VHOST_MAX_PRINT_BUFF - strnlen(packet, VHOST_MAX_PRINT_BUFF), \
517                         "%02hhx ", pkt_addr[index]); \
518         } \
519         snprintf(packet + strnlen(packet, VHOST_MAX_PRINT_BUFF), VHOST_MAX_PRINT_BUFF - strnlen(packet, VHOST_MAX_PRINT_BUFF), "\n"); \
520         \
521         VHOST_LOG_DEBUG(VHOST_DATA, "%s", packet); \
522 } while (0)
523 #else
524 #define VHOST_LOG_DEBUG(log_type, fmt, args...) do {} while (0)
525 #define PRINT_PACKET(device, addr, size, header) do {} while (0)
526 #endif
527
528 extern uint64_t VHOST_FEATURES;
529 #define MAX_VHOST_DEVICE        1024
530 extern struct virtio_net *vhost_devices[MAX_VHOST_DEVICE];
531
532 /* Convert guest physical address to host physical address */
533 static __rte_always_inline rte_iova_t
534 gpa_to_hpa(struct virtio_net *dev, uint64_t gpa, uint64_t size)
535 {
536         uint32_t i;
537         struct guest_page *page;
538
539         for (i = 0; i < dev->nr_guest_pages; i++) {
540                 page = &dev->guest_pages[i];
541
542                 if (gpa >= page->guest_phys_addr &&
543                     gpa + size < page->guest_phys_addr + page->size) {
544                         return gpa - page->guest_phys_addr +
545                                page->host_phys_addr;
546                 }
547         }
548
549         return 0;
550 }
551
552 static __rte_always_inline struct virtio_net *
553 get_device(int vid)
554 {
555         struct virtio_net *dev = vhost_devices[vid];
556
557         if (unlikely(!dev)) {
558                 RTE_LOG(ERR, VHOST_CONFIG,
559                         "(%d) device not found.\n", vid);
560         }
561
562         return dev;
563 }
564
565 int vhost_new_device(void);
566 void cleanup_device(struct virtio_net *dev, int destroy);
567 void reset_device(struct virtio_net *dev);
568 void vhost_destroy_device(int);
569 void vhost_destroy_device_notify(struct virtio_net *dev);
570
571 void cleanup_vq(struct vhost_virtqueue *vq, int destroy);
572 void free_vq(struct vhost_virtqueue *vq);
573
574 int alloc_vring_queue(struct virtio_net *dev, uint32_t vring_idx);
575
576 void vhost_attach_vdpa_device(int vid, int did);
577 void vhost_detach_vdpa_device(int vid);
578
579 void vhost_set_ifname(int, const char *if_name, unsigned int if_len);
580 void vhost_enable_dequeue_zero_copy(int vid);
581 void vhost_set_builtin_virtio_net(int vid, bool enable);
582
583 struct vhost_device_ops const *vhost_driver_callback_get(const char *path);
584
585 /*
586  * Backend-specific cleanup.
587  *
588  * TODO: fix it; we have one backend now
589  */
590 void vhost_backend_cleanup(struct virtio_net *dev);
591
592 uint64_t __vhost_iova_to_vva(struct virtio_net *dev, struct vhost_virtqueue *vq,
593                         uint64_t iova, uint64_t *len, uint8_t perm);
594 int vring_translate(struct virtio_net *dev, struct vhost_virtqueue *vq);
595 void vring_invalidate(struct virtio_net *dev, struct vhost_virtqueue *vq);
596
597 static __rte_always_inline uint64_t
598 vhost_iova_to_vva(struct virtio_net *dev, struct vhost_virtqueue *vq,
599                         uint64_t iova, uint64_t *len, uint8_t perm)
600 {
601         if (!(dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM)))
602                 return rte_vhost_va_from_guest_pa(dev->mem, iova, len);
603
604         return __vhost_iova_to_vva(dev, vq, iova, len, perm);
605 }
606
607 #define vhost_used_event(vr) \
608         (*(volatile uint16_t*)&(vr)->avail->ring[(vr)->size])
609
610 /*
611  * The following is used with VIRTIO_RING_F_EVENT_IDX.
612  * Assuming a given event_idx value from the other size, if we have
613  * just incremented index from old to new_idx, should we trigger an
614  * event?
615  */
616 static __rte_always_inline int
617 vhost_need_event(uint16_t event_idx, uint16_t new_idx, uint16_t old)
618 {
619         return (uint16_t)(new_idx - event_idx - 1) < (uint16_t)(new_idx - old);
620 }
621
622 static __rte_always_inline void
623 vhost_vring_call(struct virtio_net *dev, struct vhost_virtqueue *vq)
624 {
625         /* Flush used->idx update before we read avail->flags. */
626         rte_smp_mb();
627
628         /* Don't kick guest if we don't reach index specified by guest. */
629         if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX)) {
630                 uint16_t old = vq->signalled_used;
631                 uint16_t new = vq->last_used_idx;
632
633                 VHOST_LOG_DEBUG(VHOST_DATA, "%s: used_event_idx=%d, old=%d, new=%d\n",
634                         __func__,
635                         vhost_used_event(vq),
636                         old, new);
637                 if (vhost_need_event(vhost_used_event(vq), new, old)
638                         && (vq->callfd >= 0)) {
639                         vq->signalled_used = vq->last_used_idx;
640                         eventfd_write(vq->callfd, (eventfd_t) 1);
641                 }
642         } else {
643                 /* Kick the guest if necessary. */
644                 if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT)
645                                 && (vq->callfd >= 0))
646                         eventfd_write(vq->callfd, (eventfd_t)1);
647         }
648 }
649
650 #endif /* _VHOST_NET_CDEV_H_ */