net/virtio: fix incorrect avail desc id
PATCH 1/1 net/virtio: fix incorrect avail desc id
From: Xuan Ding <[email protected]>
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.
--- drivers/net/virtio/virtqueue.h | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/virtio/virtqueue.h +3 -0
@@ -709,6 +709,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;
Signature · 1 line
2.17.1
Quoted 23 lines · On 10/21/21 16:25, [email protected] wrote:
From: Xuan Ding <[email protected]>
Vhost will update desc’s Buffer ID advance to next used descriptor when
VIRTIO_F_IN_ORDERfeature negotiated. When virtio reuses the descriptor, the Buffer ID should be restored evenVIRTQ_DESC_F_INDIRECTfeature negotiated.Fixes b473061b0e1d ("net/virtio: fix indirect descriptors in packed datapaths")Signed-off-by Xuan Ding <[email protected]>Signed-off-by Yong Liu <[email protected]>Signed-off-by Miao Li <[email protected]>--- drivers/net/virtio/virtqueue.h | 3 +++ 1 file changed, 3 insertions(+)drivers/net/virtio/virtqueue.h +0
-0
drivers/net/virtio/virtqueue.h virtqueue_enqueue_xmit_packed(struct virtnet_tx *txvq, struct rte_mbuf *cookie, · line 717
Quoted 9 lines
drivers/net/virtio/virtqueue.h +3
-0@@ -709,6 +709,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;
Thanks,
Maxime
Maxime Coquelin
AppliedQuoted 23 lines · On 10/21/21 16:25, [email protected] wrote:
From: Xuan Ding <[email protected]>
Vhost will update desc’s Buffer ID advance to next used descriptor when
VIRTIO_F_IN_ORDERfeature negotiated. When virtio reuses the descriptor, the Buffer ID should be restored evenVIRTQ_DESC_F_INDIRECTfeature negotiated.Fixes b473061b0e1d ("net/virtio: fix indirect descriptors in packed datapaths")Signed-off-by Xuan Ding <[email protected]>Signed-off-by Yong Liu <[email protected]>Signed-off-by Miao Li <[email protected]>--- drivers/net/virtio/virtqueue.h | 3 +++ 1 file changed, 3 insertions(+)drivers/net/virtio/virtqueue.h +0
-0
drivers/net/virtio/virtqueue.h virtqueue_enqueue_xmit_packed(struct virtnet_tx *txvq, struct rte_mbuf *cookie, · line 717
Quoted 9 lines
drivers/net/virtio/virtqueue.h +3
-0@@ -709,6 +709,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;
Applied to dpdk-next-virtio/main.
Thanks,
Maxime