mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Machon <daniel.machon@microchip.com>
To: Horatiu Vultur <horatiu.vultur@microchip.com>,
	<UNGLinuxDriver@microchip.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Daniel Machon <daniel.machon@microchip.com>
Subject: [PATCH net-next] net: lan966x: free the RX pages when the TX allocation fails
Date: Tue, 17 Nov 2026 13:49:50 +0100	[thread overview]
Message-ID: <20261117-lan966x-rx-pages-tx-alloc-fail-v1-1-13f310d66650@microchip.com> (raw)

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>


             reply	other threads:[~2026-11-17 12:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 12:49 Daniel Machon [this message]
2026-11-17 12:53 ` netdev-bot+sinfo
2026-11-17 13:18 ` Nicolai Buchwitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261117-lan966x-rx-pages-tx-alloc-fail-v1-1-13f310d66650@microchip.com \
    --to=daniel.machon@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horatiu.vultur@microchip.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®