Skip to contentSkip to conversation

vhost: fix packed ring zero-copy

PATCH Applied Marvin Liu 3 participants 3 messages Mar 16, 2020 – Apr 10, 2020

lore
Share & tools
lore

Marvin Liu

author
#0 lore raw

PATCH 1/1 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")
lib/librte_vhost/virtio_net.c +2 -2
index 37c47c7dc..210415904 100644
@@ -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);
Signature · 1 line
2.17.1
Tested-by on v1 1/1
#1 lore raw

Regards,
Xiao Qimai

Quoted 46 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Marvin Liu
Sent: Monday, March 16, 2020 11:38 PM
To: [email protected]; Wang, Zhihong <[email protected]>; Ye, Xiaolong <[email protected]>
Cc: [email protected]; [email protected]; Liu, Yong <[email protected]>
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: [email protected]

lib/librte_vhost/virtio_net.c index renamed from lib/librte_vhost/virtio_net.c +0 -0

37c47c7dc..210415904 100644

lib/librte_vhost/virtio_net.c +2 -2
@@ -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

#2 lore raw
In reply to Marvin Liu
Quoted 10 lines · 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")

Applied to dpdk-next-virtio/master.

Thanks,
Maxime