net: add rte prefix to ether structures
[dpdk.git] / lib / librte_vhost / vhost.h
index bcfce27..d49c3b8 100644 (file)
@@ -308,7 +308,7 @@ struct virtio_net {
        uint64_t                log_size;
        uint64_t                log_base;
        uint64_t                log_addr;
-       struct ether_addr       mac;
+       struct rte_ether_addr   mac;
        uint16_t                mtu;
 
        struct vhost_device_ops const *notify_ops;
@@ -633,16 +633,20 @@ vhost_vring_call_split(struct virtio_net *dev, struct vhost_virtqueue *vq)
        if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX)) {
                uint16_t old = vq->signalled_used;
                uint16_t new = vq->last_used_idx;
+               bool signalled_used_valid = vq->signalled_used_valid;
+
+               vq->signalled_used = new;
+               vq->signalled_used_valid = true;
 
                VHOST_LOG_DEBUG(VHOST_DATA, "%s: used_event_idx=%d, old=%d, new=%d\n",
                        __func__,
                        vhost_used_event(vq),
                        old, new);
-               if (vhost_need_event(vhost_used_event(vq), new, old)
-                       && (vq->callfd >= 0)) {
-                       vq->signalled_used = vq->last_used_idx;
+
+               if ((vhost_need_event(vhost_used_event(vq), new, old) &&
+                                       (vq->callfd >= 0)) ||
+                               unlikely(!signalled_used_valid))
                        eventfd_write(vq->callfd, (eventfd_t) 1);
-               }
        } else {
                /* Kick the guest if necessary. */
                if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT)
@@ -757,4 +761,22 @@ restore_mbuf(struct rte_mbuf *m)
        }
 }
 
+static __rte_always_inline bool
+mbuf_is_consumed(struct rte_mbuf *m)
+{
+       while (m) {
+               if (rte_mbuf_refcnt_read(m) > 1)
+                       return false;
+               m = m->next;
+       }
+
+       return true;
+}
+
+static __rte_always_inline void
+put_zmbuf(struct zcopy_mbuf *zmbuf)
+{
+       zmbuf->in_use = 0;
+}
+
 #endif /* _VHOST_NET_CDEV_H_ */