From: Marvin Liu Date: Mon, 24 Feb 2020 15:14:19 +0000 (+0800) Subject: vhost: fix packed ring zero-copy X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=2a0ff4d55445988629e1a00afdf542c5e62387fa;p=dpdk.git 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 Reported-by: Yinan Wang Reviewed-by: Maxime Coquelin --- diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 37c47c7dc0..2104159047 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);