From 1d8161ba02abf28131e52e74f72af4f9cdc75907 Mon Sep 17 00:00:00 2001 From: Tiwei Bie Date: Tue, 24 Oct 2017 11:12:30 +0800 Subject: [PATCH] vhost: fix dequeue offload support When offload is enabled, vhost needs to access the first mbuf to get the packet info, e.g. TCP header. So we couldn't delay the data copy in this case. Fixes: e5c494a7a22b ("vhost: batch small guest memory copies") Reported-by: Lei Yao Signed-off-by: Tiwei Bie Acked-by: Yuanhan Liu --- lib/librte_vhost/virtio_net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index b75c93cf18..3c6f1a5311 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -987,7 +987,8 @@ copy_desc_to_mbuf(struct virtio_net *dev, struct vhost_virtqueue *vq, mbuf_avail = cpy_len; } else { if (likely(cpy_len > MAX_BATCH_LEN || - copy_nb >= vq->size)) { + copy_nb >= vq->size || + (hdr && cur == m))) { rte_memcpy(rte_pktmbuf_mtod_offset(cur, void *, mbuf_offset), (void *)((uintptr_t)(desc_addr + -- 2.20.1