From ad6f01945a75dbdcacf26579d1bdf07d1f4b1e3d Mon Sep 17 00:00:00 2001 From: Xuan Ding Date: Thu, 21 Oct 2021 14:25:40 +0000 Subject: [PATCH] net/virtio: fix avail descriptor ID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Vhost will update desc’s Buffer ID advance to next used descriptor when VIRTIO_F_IN_ORDER feature negotiated. When virtio reuses the descriptor, the Buffer ID should be restored even VIRTQ_DESC_F_INDIRECT feature negotiated. Fixes: b473061b0e1d ("net/virtio: fix indirect descriptors in packed datapaths") Cc: stable@dpdk.org Signed-off-by: Xuan Ding Signed-off-by: Yong Liu Signed-off-by: Miao Li Reviewed-by: Maxime Coquelin --- drivers/net/virtio/virtqueue.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h index 4182939272..4f3dd31c10 100644 --- a/drivers/net/virtio/virtqueue.h +++ b/drivers/net/virtio/virtqueue.h @@ -732,6 +732,9 @@ virtqueue_enqueue_xmit_packed(struct virtnet_tx *txvq, struct rte_mbuf *cookie, RTE_PTR_DIFF(&txr[idx].tx_packed_indir, txr); start_dp[idx].len = (seg_num + 1) * sizeof(struct vring_packed_desc); + /* Packed descriptor id needs to be restored when inorder. */ + if (in_order) + start_dp[idx].id = idx; /* reset flags for indirect desc */ head_flags = VRING_DESC_F_INDIRECT; head_flags |= vq->vq_packed.cached_flags;