[PATCH 08/20] net/cnxk: use rte_pktmbuf_free_bulk

Stephen Hemminger stephen at networkplumber.org
Fri May 8 22:33:29 CEST 2026


Replace open-coded loop with rte_pktmbuf_free_bulk().

Generated by devtools/cocci/free_bulk.cocci.

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 drivers/net/cnxk/cnxk_ethdev.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c
index 06d1c9b362..3330dd5051 100644
--- a/drivers/net/cnxk/cnxk_ethdev.c
+++ b/drivers/net/cnxk/cnxk_ethdev.c
@@ -1913,7 +1913,7 @@ cnxk_nix_dev_stop(struct rte_eth_dev *eth_dev)
 	const struct eth_dev_ops *dev_ops = eth_dev->dev_ops;
 	struct rte_mbuf *rx_pkts[32];
 	struct rte_eth_link link;
-	int count, i, j, rc;
+	int count, i, rc;
 	void *rxq;
 
 	/* In case of Inline IPSec, will need to avoid disabling the MCAM rules and NPC Rx
@@ -1951,8 +1951,7 @@ cnxk_nix_dev_stop(struct rte_eth_dev *eth_dev)
 		rxq = eth_dev->data->rx_queues[i];
 		count = dev->rx_pkt_burst_no_offload(rxq, rx_pkts, 32);
 		while (count) {
-			for (j = 0; j < count; j++)
-				rte_pktmbuf_free(rx_pkts[j]);
+			rte_pktmbuf_free_bulk(rx_pkts, count);
 			count = dev->rx_pkt_burst_no_offload(rxq, rx_pkts, 32);
 		}
 	}
-- 
2.53.0



More information about the dev mailing list