diff mbox series

[v2] net/virtio: fix indirect descriptors reconnection

Message ID 20211013013640.71513-1-xuan.ding@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers show
Series [v2] net/virtio: fix indirect descriptors reconnection | expand

Checks

Context Check Description
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance fail Performance Testing issues
ci/github-robot: build success github build: passed
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing fail Testing issues
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/checkpatch success coding style OK

Commit Message

Xuan Ding Oct. 13, 2021, 1:36 a.m. UTC
Add initialization for packed ring indirect descriptors
in reconnection path.

Fixes: 381f39ebb78a ("net/virtio: fix packed ring indirect descricptors setup")
Cc: stable@dpdk.org
Cc: yong.liu@intel.com

Signed-off-by: Xuan Ding <xuan.ding@intel.com>
Tested-by: Yinan Wang <yinan.wang@intel.com>
---

v2:
* Fix the position of some declarations.
---
 drivers/net/virtio/virtqueue.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Maxime Coquelin Oct. 14, 2021, 7:59 a.m. UTC | #1
On 10/13/21 03:36, Xuan Ding wrote:
> Add initialization for packed ring indirect descriptors
> in reconnection path.
> 
> Fixes: 381f39ebb78a ("net/virtio: fix packed ring indirect descricptors setup")
> Cc: stable@dpdk.org
> Cc: yong.liu@intel.com
> 
> Signed-off-by: Xuan Ding <xuan.ding@intel.com>
> Tested-by: Yinan Wang <yinan.wang@intel.com>
> ---
> 
> v2:
> * Fix the position of some declarations.
> ---
>   drivers/net/virtio/virtqueue.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks!
Maxime
Maxime Coquelin Oct. 21, 2021, 12:32 p.m. UTC | #2
On 10/13/21 03:36, Xuan Ding wrote:
> Add initialization for packed ring indirect descriptors
> in reconnection path.
> 
> Fixes: 381f39ebb78a ("net/virtio: fix packed ring indirect descricptors setup")
> Cc: stable@dpdk.org
> Cc: yong.liu@intel.com
> 
> Signed-off-by: Xuan Ding <xuan.ding@intel.com>
> Tested-by: Yinan Wang <yinan.wang@intel.com>
> ---
> 
> v2:
> * Fix the position of some declarations.
> ---
>   drivers/net/virtio/virtqueue.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
>

Applied to dpdk-next-virtio/main.

Thanks,
Maxime
diff mbox series

Patch

diff --git a/drivers/net/virtio/virtqueue.c b/drivers/net/virtio/virtqueue.c
index 1f9af3c31b..65bf792eb0 100644
--- a/drivers/net/virtio/virtqueue.c
+++ b/drivers/net/virtio/virtqueue.c
@@ -186,6 +186,8 @@  virtqueue_txvq_reset_packed(struct virtqueue *vq)
 	struct vq_desc_extra *dxp;
 	struct virtnet_tx *txvq;
 	uint16_t desc_idx;
+	struct virtio_tx_region *txr;
+	struct vring_packed_desc *start_dp;
 
 	vq->vq_used_cons_idx = 0;
 	vq->vq_desc_head_idx = 0;
@@ -198,6 +200,7 @@  virtqueue_txvq_reset_packed(struct virtqueue *vq)
 	vq->vq_packed.event_flags_shadow = 0;
 
 	txvq = &vq->txq;
+	txr = txvq->virtio_net_hdr_mz->addr;
 	memset(txvq->mz->addr, 0, txvq->mz->len);
 	memset(txvq->virtio_net_hdr_mz->addr, 0,
 		txvq->virtio_net_hdr_mz->len);
@@ -208,6 +211,17 @@  virtqueue_txvq_reset_packed(struct virtqueue *vq)
 			rte_pktmbuf_free(dxp->cookie);
 			dxp->cookie = NULL;
 		}
+
+		if (virtio_with_feature(vq->hw, VIRTIO_RING_F_INDIRECT_DESC)) {
+			/* first indirect descriptor is always the tx header */
+			start_dp = txr[desc_idx].tx_packed_indir;
+			vring_desc_init_indirect_packed(start_dp,
+							RTE_DIM(txr[desc_idx].tx_packed_indir));
+			start_dp->addr = txvq->virtio_net_hdr_mem
+					 + desc_idx * sizeof(*txr)
+					 + offsetof(struct virtio_tx_region, tx_hdr);
+			start_dp->len = vq->hw->vtnet_hdr_size;
+		}
 	}
 
 	vring_desc_init_packed(vq, size);