DPDK patches and discussions
 help / color / mirror / Atom feed
From: xuan.ding@intel.com
To: maxime.coquelin@redhat.com, chenbo.xia@intel.com
Cc: dev@dpdk.org, jiayu.hu@intel.com, weix.ling@intel.com,
	Xuan Ding <xuan.ding@intel.com>
Subject: [PATCH] vhost: fix sync dequeue offload
Date: Fri, 24 Jun 2022 05:38:24 +0000	[thread overview]
Message-ID: <20220624053824.31432-1-xuan.ding@intel.com> (raw)

From: Xuan Ding <xuan.ding@intel.com>

This patch fixes the missing virtio net header copy in sync
dequeue path caused by refactoring, which affects dequeue
offloading.

Fixes: 6d823bb302c7("vhost: prepare sync for descriptor to mbuf refactoring")

Signed-off-by: Xuan Ding <xuan.ding@intel.com>
---
 lib/vhost/virtio_net.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
index 68a26eb17d..d5a9f7c691 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -2635,9 +2635,17 @@ desc_to_mbuf(struct virtio_net *dev, struct vhost_virtqueue *vq,
 					   buf_iova + buf_offset, cpy_len, false) < 0)
 				goto error;
 		} else {
-			sync_fill_seg(dev, vq, cur, mbuf_offset,
-				      buf_addr + buf_offset,
-				      buf_iova + buf_offset, cpy_len, false);
+			if (hdr && cur == m) {
+				rte_memcpy(rte_pktmbuf_mtod_offset(cur, void *, mbuf_offset),
+					(void *)((uintptr_t)(buf_addr + buf_offset)),
+					cpy_len);
+				vhost_log_cache_write_iova(dev, vq, buf_iova + buf_offset, cpy_len);
+				PRINT_PACKET(dev, (uintptr_t)(buf_addr + buf_offset), cpy_len, 0);
+			} else {
+				sync_fill_seg(dev, vq, cur, mbuf_offset,
+					buf_addr + buf_offset,
+					buf_iova + buf_offset, cpy_len, false);
+			}
 		}
 
 		mbuf_avail  -= cpy_len;
-- 
2.17.1


             reply	other threads:[~2022-06-24  5:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-24  5:38 xuan.ding [this message]
2022-06-24  7:48 ` Ling, WeiX
2022-07-01  9:54 ` Xia, Chenbo
2022-07-01 13:56 ` Maxime Coquelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220624053824.31432-1-xuan.ding@intel.com \
    --to=xuan.ding@intel.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=jiayu.hu@intel.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=weix.ling@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).