[dpdk-dev] vhost: fix dequeue offload support

Message ID 1508814750-12937-1-git-send-email-tiwei.bie@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Yuanhan Liu
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Tiwei Bie Oct. 24, 2017, 3:12 a.m. UTC
  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 <lei.a.yao@intel.com>
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
 lib/librte_vhost/virtio_net.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Yuanhan Liu Oct. 24, 2017, 8:44 a.m. UTC | #1
On Tue, Oct 24, 2017 at 11:12:30AM +0800, Tiwei Bie wrote:
> 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 <lei.a.yao@intel.com>
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>

Applied to dpdk-next-virtio.

Thanks.

	--yliu
  

Patch

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index b75c93c..3c6f1a5 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 +