[dpdk-stable] patch 'net/ena: fix releasing Tx ring mbufs' has been queued to stable release 20.11.2

Xueming Li xuemingl at nvidia.com
Mon May 10 18:01:28 CEST 2021


Hi,

FYI, your patch has been queued to stable release 20.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 05/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/13e3e5e93c0ffb14cf0fba04733b642940fc1ef2

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 13e3e5e93c0ffb14cf0fba04733b642940fc1ef2 Mon Sep 17 00:00:00 2001
From: David Harton <dharton at cisco.com>
Date: Mon, 5 Apr 2021 20:27:19 -0400
Subject: [PATCH] net/ena: fix releasing Tx ring mbufs
Cc: Luca Boccassi <bluca at debian.org>

[ upstream commit 3c8bc29fd07006338e3460b03655a772cd36a9e7 ]

When ena_tx_queue_release_bufs() frees the mbufs it does not clear
the mbuf pointers.  So, when the device starts and stops multiple
times it can cause the application to receive duplicate mbufs for
two different packets.  Fix the issue by clearing the mbuf pointer.

Also, while tracking down the "double free" issue the ena calls to
allocate and free mbufs in bulk were migrated to the mbuf based APIs
so the common mbuf alloc/free routines are exercised.

Fixes: 79405ee17585 ("net/ena: fix out of order completion")
Fixes: 1173fca25af9 ("ena: add polling-mode driver")

Signed-off-by: David Harton <dharton at cisco.com>
Acked-by: Michal Krawczyk <mk at semihalf.com>
---
 drivers/net/ena/ena_ethdev.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 8baec80040..1b34c2aefa 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -767,8 +767,10 @@ static void ena_tx_queue_release_bufs(struct ena_ring *ring)
 	for (i = 0; i < ring->ring_size; ++i) {
 		struct ena_tx_buffer *tx_buf = &ring->tx_buffer_info[i];
 
-		if (tx_buf->mbuf)
+		if (tx_buf->mbuf) {
 			rte_pktmbuf_free(tx_buf->mbuf);
+			tx_buf->mbuf = NULL;
+		}
 	}
 }
 
@@ -1457,7 +1459,7 @@ static int ena_populate_rx_queue(struct ena_ring *rxq, unsigned int count)
 		"bad ring state\n");
 
 	/* get resources for incoming packets */
-	rc = rte_mempool_get_bulk(rxq->mb_pool, (void **)mbufs, count);
+	rc = rte_pktmbuf_alloc_bulk(rxq->mb_pool, mbufs, count);
 	if (unlikely(rc < 0)) {
 		rte_atomic64_inc(&rxq->adapter->drv_stats->rx_nombuf);
 		++rxq->rx_stats.mbuf_alloc_fail;
@@ -1486,8 +1488,7 @@ static int ena_populate_rx_queue(struct ena_ring *rxq, unsigned int count)
 	if (unlikely(i < count)) {
 		PMD_DRV_LOG(WARNING, "refilled rx qid %d with only %d "
 			"buffers (from %d)\n", rxq->id, i, count);
-		rte_mempool_put_bulk(rxq->mb_pool, (void **)(&mbufs[i]),
-				     count - i);
+		rte_pktmbuf_free_bulk(&mbufs[i], count - i);
 		++rxq->rx_stats.refill_partial;
 	}
 
-- 
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-05-10 23:59:30.194043500 +0800
+++ 0140-net-ena-fix-releasing-Tx-ring-mbufs.patch	2021-05-10 23:59:26.550000000 +0800
@@ -1 +1 @@
-From 3c8bc29fd07006338e3460b03655a772cd36a9e7 Mon Sep 17 00:00:00 2001
+From 13e3e5e93c0ffb14cf0fba04733b642940fc1ef2 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Luca Boccassi <bluca at debian.org>
+
+[ upstream commit 3c8bc29fd07006338e3460b03655a772cd36a9e7 ]
@@ -17 +19,0 @@
-Cc: stable at dpdk.org
@@ -26 +28 @@
-index 9aa51c9dcf..f60e843b7f 100644
+index 8baec80040..1b34c2aefa 100644


More information about the stable mailing list