DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] vhost: fix sync dequeue offload
@ 2022-06-24  5:38 xuan.ding
  2022-06-24  7:48 ` Ling, WeiX
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: xuan.ding @ 2022-06-24  5:38 UTC (permalink / raw)
  To: maxime.coquelin, chenbo.xia; +Cc: dev, jiayu.hu, weix.ling, Xuan Ding

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] vhost: fix sync dequeue offload
  2022-06-24  5:38 [PATCH] vhost: fix sync dequeue offload xuan.ding
@ 2022-06-24  7:48 ` Ling, WeiX
  2022-07-01  9:54 ` Xia, Chenbo
  2022-07-01 13:56 ` Maxime Coquelin
  2 siblings, 0 replies; 4+ messages in thread
From: Ling, WeiX @ 2022-06-24  7:48 UTC (permalink / raw)
  To: Ding, Xuan, maxime.coquelin, Xia, Chenbo; +Cc: dev, Hu, Jiayu

> -----Original Message-----
> From: Ding, Xuan <xuan.ding@intel.com>
> Sent: Friday, June 24, 2022 1:38 PM
> To: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>
> Cc: dev@dpdk.org; Hu, Jiayu <jiayu.hu@intel.com>; Ling, WeiX
> <weix.ling@intel.com>; Ding, Xuan <xuan.ding@intel.com>
> Subject: [PATCH] vhost: fix sync dequeue offload
> 
> 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(-)
> 
Tested-by: Wei Ling <weix.ling@intel.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] vhost: fix sync dequeue offload
  2022-06-24  5:38 [PATCH] vhost: fix sync dequeue offload xuan.ding
  2022-06-24  7:48 ` Ling, WeiX
@ 2022-07-01  9:54 ` Xia, Chenbo
  2022-07-01 13:56 ` Maxime Coquelin
  2 siblings, 0 replies; 4+ messages in thread
From: Xia, Chenbo @ 2022-07-01  9:54 UTC (permalink / raw)
  To: Ding, Xuan, maxime.coquelin; +Cc: dev, Hu, Jiayu, Ling, WeiX

> -----Original Message-----
> From: Ding, Xuan <xuan.ding@intel.com>
> Sent: Friday, June 24, 2022 1:38 PM
> To: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>
> Cc: dev@dpdk.org; Hu, Jiayu <jiayu.hu@intel.com>; Ling, WeiX
> <weix.ling@intel.com>; Ding, Xuan <xuan.ding@intel.com>
> Subject: [PATCH] vhost: fix sync dequeue offload
> 
> 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);

Although above logic can also be included in func sync_fill_seg, but it will need
to add a new dequeue-specific param, so I would think this patch is fine.

During review of this patch, I also notice one bug that writes dirty page log when
doing dequeue. But it's not related to this patch. So:

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com> 

> +			} 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] vhost: fix sync dequeue offload
  2022-06-24  5:38 [PATCH] vhost: fix sync dequeue offload xuan.ding
  2022-06-24  7:48 ` Ling, WeiX
  2022-07-01  9:54 ` Xia, Chenbo
@ 2022-07-01 13:56 ` Maxime Coquelin
  2 siblings, 0 replies; 4+ messages in thread
From: Maxime Coquelin @ 2022-07-01 13:56 UTC (permalink / raw)
  To: xuan.ding, chenbo.xia; +Cc: dev, jiayu.hu, weix.ling



On 6/24/22 07:38, xuan.ding@intel.com wrote:
> 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(-)
> 

Applied to dpdk-next-virtio/main.

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-01 13:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-24  5:38 [PATCH] vhost: fix sync dequeue offload xuan.ding
2022-06-24  7:48 ` Ling, WeiX
2022-07-01  9:54 ` Xia, Chenbo
2022-07-01 13:56 ` Maxime Coquelin

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).