Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] net: lan966x: free the RX pages when the TX allocation fails
@ 2026-11-17 12:49 Daniel Machon
  2026-11-17 12:53 ` netdev-bot+sinfo
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Machon @ 2026-11-17 12:49 UTC (permalink / raw)
  To: Horatiu Vultur, UNGLinuxDriver, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-kernel, Daniel Machon

lan966x_fdma_init() allocates the RX ring and fills its DCBs with pages
from the RX page pool, then allocates the TX ring. If the TX allocation
fails, the error path frees the RX ring and destroys the page pool, but
does not return the pages to the pool first.

The pool then never finishes its shutdown, and page_pool_release_retry()
keeps warning about the pages still in flight.

To let the pool shut down, return the RX pages before destroying it, as
lan966x_fdma_deinit() does. lan966x_fdma_rx_alloc() does not check that
every DCB got its pages, so skip the entries that are still empty.

Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
---
 drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
index 1fbe910c5ec38..586ee648c7741 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
@@ -54,9 +54,11 @@ static void lan966x_fdma_rx_free_pages(struct lan966x_rx *rx)
 	int i, j;
 
 	for (i = 0; i < fdma->n_dcbs; ++i) {
-		for (j = 0; j < fdma->n_dbs; ++j)
-			page_pool_put_full_page(rx->page_pool,
-						rx->page[i][j], false);
+		for (j = 0; j < fdma->n_dbs; ++j) {
+			if (rx->page[i][j])
+				page_pool_put_full_page(rx->page_pool,
+							rx->page[i][j], false);
+		}
 	}
 }
 
@@ -999,6 +1001,7 @@ int lan966x_fdma_init(struct lan966x *lan966x)
 
 	err = lan966x_fdma_tx_alloc(&lan966x->tx);
 	if (err) {
+		lan966x_fdma_rx_free_pages(&lan966x->rx);
 		fdma_free_coherent(lan966x->dma_dev, &lan966x->rx.fdma);
 		page_pool_destroy(lan966x->rx.page_pool);
 		return err;

---
base-commit: 994089a3fa3882f27f4bed9fc5815ee7df502e88
change-id: 20261116-lan966x-rx-pages-tx-alloc-fail-2b8e412f15f2

Best regards,
-- 
Daniel Machon <daniel.machon@microchip.com>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-17 12:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17 12:49 [PATCH net-next] net: lan966x: free the RX pages when the TX allocation fails Daniel Machon
2026-11-17 12:53 ` netdev-bot+sinfo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox