* Re: [PATCH 19.11] net/virtio: fix indirect descriptor reconnection
2021-12-07 16:50 [PATCH 19.11] net/virtio: fix indirect descriptor reconnection xuan.ding
@ 2021-12-07 9:46 ` Christian Ehrhardt
0 siblings, 0 replies; 2+ messages in thread
From: Christian Ehrhardt @ 2021-12-07 9:46 UTC (permalink / raw)
To: xuan.ding; +Cc: stable
On Tue, Dec 7, 2021 at 9:10 AM <xuan.ding@intel.com> wrote:
>
> From: Xuan Ding <xuan.ding@intel.com>
>
> [ upstream commit 04bcc80204db16ca77d1dd11a6ea1773214cc755 ]
Thank you, applied
> Add initialization for packed ring indirect descriptors
> in reconnection path.
>
> Fixes: 8c1df8846b15 ("net/virtio: fix packed ring indirect descricptors setup")
>
> Signed-off-by: Xuan Ding <xuan.ding@intel.com>
> Tested-by: Yinan Wang <yinan.wang@intel.com>
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
> drivers/net/virtio/virtqueue.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/net/virtio/virtqueue.c b/drivers/net/virtio/virtqueue.c
> index 02c8b9fc5..8195aaa8c 100644
> --- a/drivers/net/virtio/virtqueue.c
> +++ b/drivers/net/virtio/virtqueue.c
> @@ -185,6 +185,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;
> @@ -197,6 +199,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);
> @@ -207,6 +210,17 @@ virtqueue_txvq_reset_packed(struct virtqueue *vq)
> rte_pktmbuf_free(dxp->cookie);
> dxp->cookie = NULL;
> }
> +
> + if (vtpci_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);
> --
> 2.17.1
>
--
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 19.11] net/virtio: fix indirect descriptor reconnection
@ 2021-12-07 16:50 xuan.ding
2021-12-07 9:46 ` Christian Ehrhardt
0 siblings, 1 reply; 2+ messages in thread
From: xuan.ding @ 2021-12-07 16:50 UTC (permalink / raw)
To: christian.ehrhardt; +Cc: stable, Xuan Ding
From: Xuan Ding <xuan.ding@intel.com>
[ upstream commit 04bcc80204db16ca77d1dd11a6ea1773214cc755 ]
Add initialization for packed ring indirect descriptors
in reconnection path.
Fixes: 8c1df8846b15 ("net/virtio: fix packed ring indirect descricptors setup")
Signed-off-by: Xuan Ding <xuan.ding@intel.com>
Tested-by: Yinan Wang <yinan.wang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
drivers/net/virtio/virtqueue.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/net/virtio/virtqueue.c b/drivers/net/virtio/virtqueue.c
index 02c8b9fc5..8195aaa8c 100644
--- a/drivers/net/virtio/virtqueue.c
+++ b/drivers/net/virtio/virtqueue.c
@@ -185,6 +185,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;
@@ -197,6 +199,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);
@@ -207,6 +210,17 @@ virtqueue_txvq_reset_packed(struct virtqueue *vq)
rte_pktmbuf_free(dxp->cookie);
dxp->cookie = NULL;
}
+
+ if (vtpci_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);
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-07 9:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-07 16:50 [PATCH 19.11] net/virtio: fix indirect descriptor reconnection xuan.ding
2021-12-07 9:46 ` Christian Ehrhardt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).