1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2018 Intel Corporation
5 #ifndef _VHOST_NET_CDEV_H_
6 #define _VHOST_NET_CDEV_H_
10 #include <sys/types.h>
11 #include <sys/queue.h>
13 #include <linux/vhost.h>
14 #include <linux/virtio_net.h>
15 #include <sys/socket.h>
19 #include <rte_ether.h>
20 #include <rte_rwlock.h>
21 #include <rte_malloc.h>
23 #include "rte_vhost.h"
26 /* Used to indicate that the device is running on a data core */
27 #define VIRTIO_DEV_RUNNING 1
28 /* Used to indicate that the device is ready to operate */
29 #define VIRTIO_DEV_READY 2
30 /* Used to indicate that the built-in vhost net device backend is enabled */
31 #define VIRTIO_DEV_BUILTIN_VIRTIO_NET 4
32 /* Used to indicate that the device has its own data path and configured */
33 #define VIRTIO_DEV_VDPA_CONFIGURED 8
35 /* Backend value set by guest. */
36 #define VIRTIO_DEV_STOPPED -1
38 #define BUF_VECTOR_MAX 256
40 #define VHOST_LOG_CACHE_NR 32
42 #define PACKED_DESC_ENQUEUE_USED_FLAG(w) \
43 ((w) ? (VRING_DESC_F_AVAIL | VRING_DESC_F_USED | VRING_DESC_F_WRITE) : \
45 #define PACKED_DESC_SINGLE_DEQUEUE_FLAG (VRING_DESC_F_NEXT | \
46 VRING_DESC_F_INDIRECT)
48 #define PACKED_BATCH_SIZE (RTE_CACHE_LINE_SIZE / \
49 sizeof(struct vring_packed_desc))
50 #define PACKED_BATCH_MASK (PACKED_BATCH_SIZE - 1)
52 #ifdef VHOST_GCC_UNROLL_PRAGMA
53 #define vhost_for_each_try_unroll(iter, val, size) _Pragma("GCC unroll 4") \
54 for (iter = val; iter < size; iter++)
57 #ifdef VHOST_CLANG_UNROLL_PRAGMA
58 #define vhost_for_each_try_unroll(iter, val, size) _Pragma("unroll 4") \
59 for (iter = val; iter < size; iter++)
62 #ifdef VHOST_ICC_UNROLL_PRAGMA
63 #define vhost_for_each_try_unroll(iter, val, size) _Pragma("unroll (4)") \
64 for (iter = val; iter < size; iter++)
67 #ifndef vhost_for_each_try_unroll
68 #define vhost_for_each_try_unroll(iter, val, num) \
69 for (iter = val; iter < num; iter++)
73 * Structure contains buffer address, length and descriptor index
74 * from vring to do scatter RX.
84 * A structure to hold some fields needed in zero copy code path,
85 * mainly for associating an mbuf with the right desc_idx.
88 struct rte_mbuf *mbuf;
93 TAILQ_ENTRY(zcopy_mbuf) next;
95 TAILQ_HEAD(zcopy_mbuf_list, zcopy_mbuf);
98 * Structure contains the info for each batched memory copy.
100 struct batch_copy_elem {
108 * Structure that contains the info for batched dirty logging.
110 struct log_cache_entry {
115 struct vring_used_elem_packed {
122 * Structure contains variables relevant to RX/TX virtqueues.
124 struct vhost_virtqueue {
126 struct vring_desc *desc;
127 struct vring_packed_desc *desc_packed;
130 struct vring_avail *avail;
131 struct vring_packed_desc_event *driver_event;
134 struct vring_used *used;
135 struct vring_packed_desc_event *device_event;
139 uint16_t last_avail_idx;
140 uint16_t last_used_idx;
141 /* Last used index we notify to front end. */
142 uint16_t signalled_used;
143 bool signalled_used_valid;
144 #define VIRTIO_INVALID_EVENTFD (-1)
145 #define VIRTIO_UNINITIALIZED_EVENTFD (-2)
147 /* Backend value to determine if device should started/stopped */
151 rte_spinlock_t access_lock;
153 /* Used to notify the guest (trigger interrupt) */
155 /* Currently unused as polling mode is enabled */
158 /* Physical address of used ring, for logging */
159 uint64_t log_guest_addr;
161 /* inflight share memory info */
163 struct rte_vhost_inflight_info_split *inflight_split;
164 struct rte_vhost_inflight_info_packed *inflight_packed;
166 struct rte_vhost_resubmit_info *resubmit_inflight;
167 uint64_t global_counter;
171 uint16_t last_zmbuf_idx;
172 struct zcopy_mbuf *zmbufs;
173 struct zcopy_mbuf_list zmbuf_list;
176 struct vring_used_elem *shadow_used_split;
177 struct vring_used_elem_packed *shadow_used_packed;
179 uint16_t shadow_used_idx;
180 /* Record packed ring enqueue latest desc cache aligned index */
181 uint16_t shadow_aligned_idx;
182 struct vhost_vring_addr ring_addrs;
184 struct batch_copy_elem *batch_copy_elems;
185 uint16_t batch_copy_nb_elems;
186 bool used_wrap_counter;
187 bool avail_wrap_counter;
189 struct log_cache_entry log_cache[VHOST_LOG_CACHE_NR];
190 uint16_t log_cache_nb_elem;
192 rte_rwlock_t iotlb_lock;
193 rte_rwlock_t iotlb_pending_lock;
194 struct rte_mempool *iotlb_pool;
195 TAILQ_HEAD(, vhost_iotlb_entry) iotlb_list;
197 TAILQ_HEAD(, vhost_iotlb_entry) iotlb_pending_list;
198 } __rte_cache_aligned;
200 /* Old kernels have no such macros defined */
201 #ifndef VIRTIO_NET_F_GUEST_ANNOUNCE
202 #define VIRTIO_NET_F_GUEST_ANNOUNCE 21
205 #ifndef VIRTIO_NET_F_MQ
206 #define VIRTIO_NET_F_MQ 22
209 #define VHOST_MAX_VRING 0x100
210 #define VHOST_MAX_QUEUE_PAIRS 0x80
212 #ifndef VIRTIO_NET_F_MTU
213 #define VIRTIO_NET_F_MTU 3
216 #ifndef VIRTIO_F_ANY_LAYOUT
217 #define VIRTIO_F_ANY_LAYOUT 27
220 /* Declare IOMMU related bits for older kernels */
221 #ifndef VIRTIO_F_IOMMU_PLATFORM
223 #define VIRTIO_F_IOMMU_PLATFORM 33
225 struct vhost_iotlb_msg {
229 #define VHOST_ACCESS_RO 0x1
230 #define VHOST_ACCESS_WO 0x2
231 #define VHOST_ACCESS_RW 0x3
233 #define VHOST_IOTLB_MISS 1
234 #define VHOST_IOTLB_UPDATE 2
235 #define VHOST_IOTLB_INVALIDATE 3
236 #define VHOST_IOTLB_ACCESS_FAIL 4
240 #define VHOST_IOTLB_MSG 0x1
245 struct vhost_iotlb_msg iotlb;
252 * Define virtio 1.0 for older kernels
254 #ifndef VIRTIO_F_VERSION_1
255 #define VIRTIO_F_VERSION_1 32
258 /* Declare packed ring related bits for older kernels */
259 #ifndef VIRTIO_F_RING_PACKED
261 #define VIRTIO_F_RING_PACKED 34
263 struct vring_packed_desc {
270 struct vring_packed_desc_event {
277 * Declare below packed ring defines unconditionally
278 * as Kernel header might use different names.
280 #define VRING_DESC_F_AVAIL (1ULL << 7)
281 #define VRING_DESC_F_USED (1ULL << 15)
283 #define VRING_EVENT_F_ENABLE 0x0
284 #define VRING_EVENT_F_DISABLE 0x1
285 #define VRING_EVENT_F_DESC 0x2
288 * Available and used descs are in same order
290 #ifndef VIRTIO_F_IN_ORDER
291 #define VIRTIO_F_IN_ORDER 35
294 /* Features supported by this builtin vhost-user net driver. */
295 #define VIRTIO_NET_SUPPORTED_FEATURES ((1ULL << VIRTIO_NET_F_MRG_RXBUF) | \
296 (1ULL << VIRTIO_F_ANY_LAYOUT) | \
297 (1ULL << VIRTIO_NET_F_CTRL_VQ) | \
298 (1ULL << VIRTIO_NET_F_CTRL_RX) | \
299 (1ULL << VIRTIO_NET_F_GUEST_ANNOUNCE) | \
300 (1ULL << VIRTIO_NET_F_MQ) | \
301 (1ULL << VIRTIO_F_VERSION_1) | \
302 (1ULL << VHOST_F_LOG_ALL) | \
303 (1ULL << VHOST_USER_F_PROTOCOL_FEATURES) | \
304 (1ULL << VIRTIO_NET_F_GSO) | \
305 (1ULL << VIRTIO_NET_F_HOST_TSO4) | \
306 (1ULL << VIRTIO_NET_F_HOST_TSO6) | \
307 (1ULL << VIRTIO_NET_F_HOST_UFO) | \
308 (1ULL << VIRTIO_NET_F_HOST_ECN) | \
309 (1ULL << VIRTIO_NET_F_CSUM) | \
310 (1ULL << VIRTIO_NET_F_GUEST_CSUM) | \
311 (1ULL << VIRTIO_NET_F_GUEST_TSO4) | \
312 (1ULL << VIRTIO_NET_F_GUEST_TSO6) | \
313 (1ULL << VIRTIO_NET_F_GUEST_UFO) | \
314 (1ULL << VIRTIO_NET_F_GUEST_ECN) | \
315 (1ULL << VIRTIO_RING_F_INDIRECT_DESC) | \
316 (1ULL << VIRTIO_RING_F_EVENT_IDX) | \
317 (1ULL << VIRTIO_NET_F_MTU) | \
318 (1ULL << VIRTIO_F_IN_ORDER) | \
319 (1ULL << VIRTIO_F_IOMMU_PLATFORM) | \
320 (1ULL << VIRTIO_F_RING_PACKED))
324 uint64_t guest_phys_addr;
325 uint64_t host_phys_addr;
329 struct inflight_mem_info {
336 * Device structure contains all configuration information relating
340 /* Frontend (QEMU) memory and memory region information */
341 struct rte_vhost_memory *mem;
343 uint64_t protocol_features;
347 /* to tell if we need broadcast rarp packet */
348 rte_atomic16_t broadcast_rarp;
350 int dequeue_zero_copy;
353 struct vhost_virtqueue *virtqueue[VHOST_MAX_QUEUE_PAIRS * 2];
354 struct inflight_mem_info *inflight_info;
355 #define IF_NAME_SZ (PATH_MAX > IFNAMSIZ ? PATH_MAX : IFNAMSIZ)
356 char ifname[IF_NAME_SZ];
360 struct rte_ether_addr mac;
363 struct vhost_device_ops const *notify_ops;
365 uint32_t nr_guest_pages;
366 uint32_t max_guest_pages;
367 struct guest_page *guest_pages;
370 rte_spinlock_t slave_req_lock;
373 int postcopy_listening;
376 * Device id to identify a specific backend device.
377 * It's set to -1 for the default software implementation.
381 /* context data for the external message handlers */
383 /* pre and post vhost user message handlers for the device */
384 struct rte_vhost_user_extern_ops extern_ops;
385 } __rte_cache_aligned;
387 static __rte_always_inline bool
388 vq_is_packed(struct virtio_net *dev)
390 return dev->features & (1ull << VIRTIO_F_RING_PACKED);
394 desc_is_avail(struct vring_packed_desc *desc, bool wrap_counter)
396 uint16_t flags = __atomic_load_n(&desc->flags, __ATOMIC_ACQUIRE);
398 return wrap_counter == !!(flags & VRING_DESC_F_AVAIL) &&
399 wrap_counter != !!(flags & VRING_DESC_F_USED);
403 vq_inc_last_used_packed(struct vhost_virtqueue *vq, uint16_t num)
405 vq->last_used_idx += num;
406 if (vq->last_used_idx >= vq->size) {
407 vq->used_wrap_counter ^= 1;
408 vq->last_used_idx -= vq->size;
413 vq_inc_last_avail_packed(struct vhost_virtqueue *vq, uint16_t num)
415 vq->last_avail_idx += num;
416 if (vq->last_avail_idx >= vq->size) {
417 vq->avail_wrap_counter ^= 1;
418 vq->last_avail_idx -= vq->size;
422 void __vhost_log_cache_write(struct virtio_net *dev,
423 struct vhost_virtqueue *vq,
424 uint64_t addr, uint64_t len);
425 void __vhost_log_cache_write_iova(struct virtio_net *dev,
426 struct vhost_virtqueue *vq,
427 uint64_t iova, uint64_t len);
428 void __vhost_log_cache_sync(struct virtio_net *dev,
429 struct vhost_virtqueue *vq);
430 void __vhost_log_write(struct virtio_net *dev, uint64_t addr, uint64_t len);
431 void __vhost_log_write_iova(struct virtio_net *dev, struct vhost_virtqueue *vq,
432 uint64_t iova, uint64_t len);
434 static __rte_always_inline void
435 vhost_log_write(struct virtio_net *dev, uint64_t addr, uint64_t len)
437 if (unlikely(dev->features & (1ULL << VHOST_F_LOG_ALL)))
438 __vhost_log_write(dev, addr, len);
441 static __rte_always_inline void
442 vhost_log_cache_sync(struct virtio_net *dev, struct vhost_virtqueue *vq)
444 if (unlikely(dev->features & (1ULL << VHOST_F_LOG_ALL)))
445 __vhost_log_cache_sync(dev, vq);
448 static __rte_always_inline void
449 vhost_log_cache_write(struct virtio_net *dev, struct vhost_virtqueue *vq,
450 uint64_t addr, uint64_t len)
452 if (unlikely(dev->features & (1ULL << VHOST_F_LOG_ALL)))
453 __vhost_log_cache_write(dev, vq, addr, len);
456 static __rte_always_inline void
457 vhost_log_cache_used_vring(struct virtio_net *dev, struct vhost_virtqueue *vq,
458 uint64_t offset, uint64_t len)
460 vhost_log_cache_write(dev, vq, vq->log_guest_addr + offset, len);
463 static __rte_always_inline void
464 vhost_log_used_vring(struct virtio_net *dev, struct vhost_virtqueue *vq,
465 uint64_t offset, uint64_t len)
467 vhost_log_write(dev, vq->log_guest_addr + offset, len);
470 static __rte_always_inline void
471 vhost_log_cache_write_iova(struct virtio_net *dev, struct vhost_virtqueue *vq,
472 uint64_t iova, uint64_t len)
474 if (likely(!(dev->features & (1ULL << VHOST_F_LOG_ALL))))
477 if (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))
478 __vhost_log_cache_write_iova(dev, vq, iova, len);
480 __vhost_log_cache_write(dev, vq, iova, len);
483 static __rte_always_inline void
484 vhost_log_write_iova(struct virtio_net *dev, struct vhost_virtqueue *vq,
485 uint64_t iova, uint64_t len)
487 if (likely(!(dev->features & (1ULL << VHOST_F_LOG_ALL))))
490 if (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))
491 __vhost_log_write_iova(dev, vq, iova, len);
493 __vhost_log_write(dev, iova, len);
496 /* Macros for printing using RTE_LOG */
497 #define RTE_LOGTYPE_VHOST_CONFIG RTE_LOGTYPE_USER1
498 #define RTE_LOGTYPE_VHOST_DATA RTE_LOGTYPE_USER1
500 #ifdef RTE_LIBRTE_VHOST_DEBUG
501 #define VHOST_MAX_PRINT_BUFF 6072
502 #define VHOST_LOG_DEBUG(log_type, fmt, args...) \
503 RTE_LOG(DEBUG, log_type, fmt, ##args)
504 #define PRINT_PACKET(device, addr, size, header) do { \
505 char *pkt_addr = (char *)(addr); \
506 unsigned int index; \
507 char packet[VHOST_MAX_PRINT_BUFF]; \
510 snprintf(packet, VHOST_MAX_PRINT_BUFF, "(%d) Header size %d: ", (device->vid), (size)); \
512 snprintf(packet, VHOST_MAX_PRINT_BUFF, "(%d) Packet size %d: ", (device->vid), (size)); \
513 for (index = 0; index < (size); index++) { \
514 snprintf(packet + strnlen(packet, VHOST_MAX_PRINT_BUFF), VHOST_MAX_PRINT_BUFF - strnlen(packet, VHOST_MAX_PRINT_BUFF), \
515 "%02hhx ", pkt_addr[index]); \
517 snprintf(packet + strnlen(packet, VHOST_MAX_PRINT_BUFF), VHOST_MAX_PRINT_BUFF - strnlen(packet, VHOST_MAX_PRINT_BUFF), "\n"); \
519 VHOST_LOG_DEBUG(VHOST_DATA, "%s", packet); \
522 #define VHOST_LOG_DEBUG(log_type, fmt, args...) do {} while (0)
523 #define PRINT_PACKET(device, addr, size, header) do {} while (0)
526 extern uint64_t VHOST_FEATURES;
527 #define MAX_VHOST_DEVICE 1024
528 extern struct virtio_net *vhost_devices[MAX_VHOST_DEVICE];
530 /* Convert guest physical address to host physical address */
531 static __rte_always_inline rte_iova_t
532 gpa_to_hpa(struct virtio_net *dev, uint64_t gpa, uint64_t size)
535 struct guest_page *page;
537 for (i = 0; i < dev->nr_guest_pages; i++) {
538 page = &dev->guest_pages[i];
540 if (gpa >= page->guest_phys_addr &&
541 gpa + size < page->guest_phys_addr + page->size) {
542 return gpa - page->guest_phys_addr +
543 page->host_phys_addr;
550 static __rte_always_inline uint64_t
551 hva_to_gpa(struct virtio_net *dev, uint64_t vva, uint64_t len)
553 struct rte_vhost_mem_region *r;
556 if (unlikely(!dev || !dev->mem))
559 for (i = 0; i < dev->mem->nregions; i++) {
560 r = &dev->mem->regions[i];
562 if (vva >= r->host_user_addr &&
563 vva + len < r->host_user_addr + r->size) {
564 return r->guest_phys_addr + vva - r->host_user_addr;
570 static __rte_always_inline struct virtio_net *
573 struct virtio_net *dev = vhost_devices[vid];
575 if (unlikely(!dev)) {
576 RTE_LOG(ERR, VHOST_CONFIG,
577 "(%d) device not found.\n", vid);
583 int vhost_new_device(void);
584 void cleanup_device(struct virtio_net *dev, int destroy);
585 void reset_device(struct virtio_net *dev);
586 void vhost_destroy_device(int);
587 void vhost_destroy_device_notify(struct virtio_net *dev);
589 void cleanup_vq(struct vhost_virtqueue *vq, int destroy);
590 void cleanup_vq_inflight(struct virtio_net *dev, struct vhost_virtqueue *vq);
591 void free_vq(struct virtio_net *dev, struct vhost_virtqueue *vq);
593 int alloc_vring_queue(struct virtio_net *dev, uint32_t vring_idx);
595 void vhost_attach_vdpa_device(int vid, int did);
597 void vhost_set_ifname(int, const char *if_name, unsigned int if_len);
598 void vhost_enable_dequeue_zero_copy(int vid);
599 void vhost_set_builtin_virtio_net(int vid, bool enable);
600 void vhost_enable_extbuf(int vid);
601 void vhost_enable_linearbuf(int vid);
603 struct vhost_device_ops const *vhost_driver_callback_get(const char *path);
606 * Backend-specific cleanup.
608 * TODO: fix it; we have one backend now
610 void vhost_backend_cleanup(struct virtio_net *dev);
612 uint64_t __vhost_iova_to_vva(struct virtio_net *dev, struct vhost_virtqueue *vq,
613 uint64_t iova, uint64_t *len, uint8_t perm);
614 void *vhost_alloc_copy_ind_table(struct virtio_net *dev,
615 struct vhost_virtqueue *vq,
616 uint64_t desc_addr, uint64_t desc_len);
617 int vring_translate(struct virtio_net *dev, struct vhost_virtqueue *vq);
618 void vring_invalidate(struct virtio_net *dev, struct vhost_virtqueue *vq);
620 static __rte_always_inline uint64_t
621 vhost_iova_to_vva(struct virtio_net *dev, struct vhost_virtqueue *vq,
622 uint64_t iova, uint64_t *len, uint8_t perm)
624 if (!(dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM)))
625 return rte_vhost_va_from_guest_pa(dev->mem, iova, len);
627 return __vhost_iova_to_vva(dev, vq, iova, len, perm);
630 #define vhost_avail_event(vr) \
631 (*(volatile uint16_t*)&(vr)->used->ring[(vr)->size])
632 #define vhost_used_event(vr) \
633 (*(volatile uint16_t*)&(vr)->avail->ring[(vr)->size])
636 * The following is used with VIRTIO_RING_F_EVENT_IDX.
637 * Assuming a given event_idx value from the other size, if we have
638 * just incremented index from old to new_idx, should we trigger an
641 static __rte_always_inline int
642 vhost_need_event(uint16_t event_idx, uint16_t new_idx, uint16_t old)
644 return (uint16_t)(new_idx - event_idx - 1) < (uint16_t)(new_idx - old);
647 static __rte_always_inline void
648 vhost_vring_call_split(struct virtio_net *dev, struct vhost_virtqueue *vq)
650 /* Flush used->idx update before we read avail->flags. */
653 /* Don't kick guest if we don't reach index specified by guest. */
654 if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX)) {
655 uint16_t old = vq->signalled_used;
656 uint16_t new = vq->last_used_idx;
657 bool signalled_used_valid = vq->signalled_used_valid;
659 vq->signalled_used = new;
660 vq->signalled_used_valid = true;
662 VHOST_LOG_DEBUG(VHOST_DATA, "%s: used_event_idx=%d, old=%d, new=%d\n",
664 vhost_used_event(vq),
667 if ((vhost_need_event(vhost_used_event(vq), new, old) &&
668 (vq->callfd >= 0)) ||
669 unlikely(!signalled_used_valid)) {
670 eventfd_write(vq->callfd, (eventfd_t) 1);
671 if (dev->notify_ops->guest_notified)
672 dev->notify_ops->guest_notified(dev->vid);
675 /* Kick the guest if necessary. */
676 if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT)
677 && (vq->callfd >= 0)) {
678 eventfd_write(vq->callfd, (eventfd_t)1);
679 if (dev->notify_ops->guest_notified)
680 dev->notify_ops->guest_notified(dev->vid);
685 static __rte_always_inline void
686 vhost_vring_call_packed(struct virtio_net *dev, struct vhost_virtqueue *vq)
688 uint16_t old, new, off, off_wrap;
689 bool signalled_used_valid, kick = false;
691 /* Flush used desc update. */
694 if (!(dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX))) {
695 if (vq->driver_event->flags !=
696 VRING_EVENT_F_DISABLE)
701 old = vq->signalled_used;
702 new = vq->last_used_idx;
703 vq->signalled_used = new;
704 signalled_used_valid = vq->signalled_used_valid;
705 vq->signalled_used_valid = true;
707 if (vq->driver_event->flags != VRING_EVENT_F_DESC) {
708 if (vq->driver_event->flags != VRING_EVENT_F_DISABLE)
713 if (unlikely(!signalled_used_valid)) {
720 off_wrap = vq->driver_event->off_wrap;
721 off = off_wrap & ~(1 << 15);
726 if (vq->used_wrap_counter != off_wrap >> 15)
729 if (vhost_need_event(off, new, old))
733 eventfd_write(vq->callfd, (eventfd_t)1);
734 if (dev->notify_ops->guest_notified)
735 dev->notify_ops->guest_notified(dev->vid);
739 static __rte_always_inline void
740 free_ind_table(void *idesc)
745 static __rte_always_inline void
746 restore_mbuf(struct rte_mbuf *m)
748 uint32_t mbuf_size, priv_size;
751 priv_size = rte_pktmbuf_priv_size(m->pool);
752 mbuf_size = sizeof(struct rte_mbuf) + priv_size;
753 /* start of buffer is after mbuf structure and priv data */
755 m->buf_addr = (char *)m + mbuf_size;
756 m->buf_iova = rte_mempool_virt2iova(m) + mbuf_size;
761 static __rte_always_inline bool
762 mbuf_is_consumed(struct rte_mbuf *m)
765 if (rte_mbuf_refcnt_read(m) > 1)
773 static __rte_always_inline void
774 put_zmbuf(struct zcopy_mbuf *zmbuf)
779 #endif /* _VHOST_NET_CDEV_H_ */