[dpdk-stable] patch 'net/virtio: fix Tx completed mbuf leak on device stop' has been queued to stable release 20.11.4
Xueming Li
xuemingl at nvidia.com
Wed Nov 10 07:29:34 CET 2021
Hi,
FYI, your patch has been queued to stable release 20.11.4
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/12/21. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://github.com/steevenlee/dpdk
This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/758eb05f2b576e4bd2267dca6b3142247f98d963
Thanks.
Xueming Li <xuemingl at nvidia.com>
---
>From 758eb05f2b576e4bd2267dca6b3142247f98d963 Mon Sep 17 00:00:00 2001
From: Ivan Ilchenko <ivan.ilchenko at oktetlabs.ru>
Date: Wed, 15 Sep 2021 12:19:42 +0300
Subject: [PATCH] net/virtio: fix Tx completed mbuf leak on device stop
Cc: Xueming Li <xuemingl at nvidia.com>
[ upstream commit 9de76dfb929807f6fbf0b7ceec4bc8274221ddde ]
Free Tx completed mbufs on device stop. Not completed Tx mbufs cannot be
freed since they are still in use.
Fixes: c1f86306a026 ("virtio: add new driver")
Signed-off-by: Ivan Ilchenko <ivan.ilchenko at oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
---
drivers/net/virtio/virtio_ethdev.c | 31 ++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 7bbd483952..ed20b1427e 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -2590,6 +2590,35 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev)
PMD_INIT_LOG(DEBUG, "%d mbufs freed", mbuf_num);
}
+static void
+virtio_tx_completed_cleanup(struct rte_eth_dev *dev)
+{
+ struct virtio_hw *hw = dev->data->dev_private;
+ struct virtqueue *vq;
+ uint32_t qidx;
+ void (*xmit_cleanup)(struct virtqueue *vq, uint16_t nb_used);
+
+ if (vtpci_packed_queue(hw)) {
+ if (hw->use_vec_tx)
+ xmit_cleanup = &virtio_xmit_cleanup_inorder_packed;
+ else if (vtpci_with_feature(hw, VIRTIO_F_IN_ORDER))
+ xmit_cleanup = &virtio_xmit_cleanup_inorder_packed;
+ else
+ xmit_cleanup = &virtio_xmit_cleanup_normal_packed;
+ } else {
+ if (hw->use_inorder_tx)
+ xmit_cleanup = &virtio_xmit_cleanup_inorder;
+ else
+ xmit_cleanup = &virtio_xmit_cleanup;
+ }
+
+ for (qidx = 0; qidx < hw->max_queue_pairs; qidx++) {
+ vq = hw->vqs[2 * qidx + VTNET_SQ_TQ_QUEUE_IDX];
+ if (vq != NULL)
+ xmit_cleanup(vq, virtqueue_nused(vq));
+ }
+}
+
/*
* Stop device: disable interrupt and mark link down
*/
@@ -2608,6 +2637,8 @@ virtio_dev_stop(struct rte_eth_dev *dev)
goto out_unlock;
hw->started = false;
+ virtio_tx_completed_cleanup(dev);
+
if (intr_conf->lsc || intr_conf->rxq) {
virtio_intr_disable(dev);
--
2.33.0
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2021-11-10 14:17:06.032792987 +0800
+++ 0090-net-virtio-fix-Tx-completed-mbuf-leak-on-device-stop.patch 2021-11-10 14:17:01.847412948 +0800
@@ -1 +1 @@
-From 9de76dfb929807f6fbf0b7ceec4bc8274221ddde Mon Sep 17 00:00:00 2001
+From 758eb05f2b576e4bd2267dca6b3142247f98d963 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 9de76dfb929807f6fbf0b7ceec4bc8274221ddde ]
@@ -10 +12,0 @@
-Cc: stable at dpdk.org
@@ -20 +22 @@
-index da1633d77e..3e3b42eaf6 100644
+index 7bbd483952..ed20b1427e 100644
@@ -23 +25 @@
-@@ -2401,6 +2401,35 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev)
+@@ -2590,6 +2590,35 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev)
@@ -32 +34 @@
-+ int qidx;
++ uint32_t qidx;
@@ -35 +37 @@
-+ if (virtio_with_packed_queue(hw)) {
++ if (vtpci_packed_queue(hw)) {
@@ -38 +40 @@
-+ else if (virtio_with_feature(hw, VIRTIO_F_IN_ORDER))
++ else if (vtpci_with_feature(hw, VIRTIO_F_IN_ORDER))
@@ -59 +61 @@
-@@ -2419,6 +2448,8 @@ virtio_dev_stop(struct rte_eth_dev *dev)
+@@ -2608,6 +2637,8 @@ virtio_dev_stop(struct rte_eth_dev *dev)
@@ -61 +63 @@
- hw->started = 0;
+ hw->started = false;
More information about the stable
mailing list