patches for DPDK stable branches
 help / color / Atom feed
* [dpdk-stable] [PATCH] vhost: fix packed ring zero-copy
@ 2020-03-16 15:38 Marvin Liu
  2020-03-23  5:40 ` [dpdk-stable] [dpdk-dev] " Xiao, QimaiX
  0 siblings, 1 reply; 2+ messages in thread
From: Marvin Liu @ 2020-03-16 15:38 UTC (permalink / raw)
  To: maxime.coquelin, zhihong.wang, xiaolong.ye; +Cc: dev, stable, Marvin Liu

Available buffer ID should be stored in the zmbuf in the packed-ring
dequeue path. There's no guarantee that local queue avail index is
equal to buffer ID.

Fixes: d1eafb532268 ("vhost: add packed ring zcopy batch and single dequeue")
Cc: stable@dpdk.org

Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reported-by: Yinan Wang <yinan.wang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 37c47c7dc..210415904 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -2004,7 +2004,7 @@ virtio_dev_tx_batch_packed_zmbuf(struct virtio_net *dev,
 
 	vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {
 		zmbufs[i]->mbuf = pkts[i];
-		zmbufs[i]->desc_idx = avail_idx + i;
+		zmbufs[i]->desc_idx = ids[i];
 		zmbufs[i]->desc_count = 1;
 	}
 
@@ -2045,7 +2045,7 @@ virtio_dev_tx_single_packed_zmbuf(struct virtio_net *dev,
 		return -1;
 	}
 	zmbuf->mbuf = *pkts;
-	zmbuf->desc_idx = vq->last_avail_idx;
+	zmbuf->desc_idx = buf_id;
 	zmbuf->desc_count = desc_count;
 
 	rte_mbuf_refcnt_update(*pkts, 1);
-- 
2.17.1


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

* Re: [dpdk-stable] [dpdk-dev] [PATCH] vhost: fix packed ring zero-copy
  2020-03-16 15:38 [dpdk-stable] [PATCH] vhost: fix packed ring zero-copy Marvin Liu
@ 2020-03-23  5:40 ` " Xiao, QimaiX
  0 siblings, 0 replies; 2+ messages in thread
From: Xiao, QimaiX @ 2020-03-23  5:40 UTC (permalink / raw)
  To: Liu, Yong, maxime.coquelin, Wang, Zhihong, Ye, Xiaolong
  Cc: dev, stable, Liu,  Yong

Tested-by: Xiao, QimaiX <qimaix.xiao@intel.com>

Regards,
Xiao Qimai

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Marvin Liu
> Sent: Monday, March 16, 2020 11:38 PM
> To: maxime.coquelin@redhat.com; Wang, Zhihong
> <zhihong.wang@intel.com>; Ye, Xiaolong <xiaolong.ye@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Liu, Yong <yong.liu@intel.com>
> Subject: [dpdk-dev] [PATCH] vhost: fix packed ring zero-copy
> 
> Available buffer ID should be stored in the zmbuf in the packed-ring
> dequeue path. There's no guarantee that local queue avail index is equal to
> buffer ID.
> 
> Fixes: d1eafb532268 ("vhost: add packed ring zcopy batch and single
> dequeue")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Marvin Liu <yong.liu@intel.com>
> Reported-by: Yinan Wang <yinan.wang@intel.com>
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> 
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index
> 37c47c7dc..210415904 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -2004,7 +2004,7 @@ virtio_dev_tx_batch_packed_zmbuf(struct
> virtio_net *dev,
> 
>  	vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {
>  		zmbufs[i]->mbuf = pkts[i];
> -		zmbufs[i]->desc_idx = avail_idx + i;
> +		zmbufs[i]->desc_idx = ids[i];
>  		zmbufs[i]->desc_count = 1;
>  	}
> 
> @@ -2045,7 +2045,7 @@ virtio_dev_tx_single_packed_zmbuf(struct
> virtio_net *dev,
>  		return -1;
>  	}
>  	zmbuf->mbuf = *pkts;
> -	zmbuf->desc_idx = vq->last_avail_idx;
> +	zmbuf->desc_idx = buf_id;
>  	zmbuf->desc_count = desc_count;
> 
>  	rte_mbuf_refcnt_update(*pkts, 1);
> --
> 2.17.1


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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-16 15:38 [dpdk-stable] [PATCH] vhost: fix packed ring zero-copy Marvin Liu
2020-03-23  5:40 ` [dpdk-stable] [dpdk-dev] " Xiao, QimaiX

patches for DPDK stable branches

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/ public-inbox