Vhost fast dequeue function will flush used ring immediately. Descriptor's flag is pre-calculated by macro.
Signed-off-by: Marvin Liu <yong....@intel.com> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 83ed2d599..cd51ed47a 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -265,6 +265,21 @@ flush_used_fast_packed(struct virtio_net *dev, struct vhost_virtqueue *vq, } } +static __rte_always_inline void +flush_dequeue_fast_used_packed(struct virtio_net *dev, + struct vhost_virtqueue *vq, uint16_t id, + uint16_t id1, uint16_t id2, uint16_t id3) +{ + uint16_t flags = 0; + + if (vq->used_wrap_counter) + flags = VIRTIO_TX_FLAG_PACKED; + else + flags = VIRTIO_TX_WRAP_FLAG_PACKED; + + flush_used_fast_packed(dev, vq, 0, 0, 0, 0, id, id1, id2, id3, flags); +} + static __rte_always_inline void flush_enqueue_fast_used_packed(struct virtio_net *dev, struct vhost_virtqueue *vq, uint64_t len, @@ -1946,6 +1961,8 @@ virtio_dev_tx_fast_packed(struct virtio_net *dev, struct vhost_virtqueue *vq, (void *)(uintptr_t)(desc_addr[3] + buf_offset), pkts[3]->pkt_len); + flush_dequeue_fast_used_packed(dev, vq, ids[0], ids[1], ids[2], + ids[3]); if (virtio_net_with_host_offload(dev)) { hdr = (struct virtio_net_hdr *)((uintptr_t)desc_addr[0]); hdr1 = (struct virtio_net_hdr *)((uintptr_t)desc_addr[1]); -- 2.17.1