🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #17890

Re: [PATCH net-next] net: lan966x: free the RX pages when the TX allocation fails

#17890
From: Nicolai Buchwitz
Date: Tue, 17 Nov 2026 13:18
60 lines
10623 bytes
On 17.11.2026 13:49, Daniel Machon wrote:
> 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,

Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>

Regards
Nicolai
Technical Details
Message-ID: <ca8a0d98bb7981610f0b4e33ce92aac0@tipi-net.de>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365296-linux-kernel-netdev=dewy.ru
References: <20261117-lan966x-rx-pages-tx-alloc-fail-v1-1-13f310d66650@microchip.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365296-linux-kernel-netdev=dewy.ru
From: nb@tipi-net.de (Nicolai Buchwitz)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next] net: lan966x: free the RX pages when the TX
 allocation fails
Date: Tue, 17 Nov 2026 14:18:40 +0100
Organization: Usenet Network
Message-ID: <ca8a0d98bb7981610f0b4e33ce92aac0@tipi-net.de>
References: <20261117-lan966x-rx-pages-tx-alloc-fail-v1-1-13f310d66650@microchip.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII;
 format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2336032"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:+86hbTrSf/FgHfNhLSOFvtekfPY= sha256:69Ze60npZOxwhUWY0SdRGVFeEpAHWY/qGmlj8MYiJc0=
	sha1:ufH+ZlFoDXAUIC2wBdU73m3s5XM= sha256:uaNrIzcu5ByzIzxzTC4WjtcJ9dhe5chjtFK4dSXi690=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 6EE14114F7E; Tue, 17 Nov 2026 16:19:16 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=tipi-net.de
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id SHBW2ay_hXKR;
	Tue, 17 Nov 2026 16:19:10 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-365296-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=tipi-net.de
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id EAC48114F78; Tue, 17 Nov 2026 16:19:01 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id EB27537D23; Tue, 17 Nov 2026 13:18:48 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794921525;
	b=o4XkjGj4RpJTRyiP3i8NMu/F2ib4eedGN1frsQ0PijwylC/1vyn6BThyolgY0SymlBxr
	 wtAol5ZhuHHyAlbjwLtJfySSPrNlE78vMUcyb1Bsnq/TGzBYNNmWVtPHFR6DsjtjeAFSz
	 16Y7xeAiVlg1hDMKsP61e8DR9QO01ayKHZEdb/Y24MHd1z7O9hppC28YjbWrfV0enlR3Y
	 LD0XBaCer0gRNOXU4jv0knuTYVqs5EzO2Yjm7Ll59pYQHpReRjY4ZKdDCF8drqfIjhrJ5
	 2chVjPO3QCU80BkGTPjhK0GmNC8F5ca5HFBA7ll/sLwS0ZPv40sRbXXN46+5x84iIlA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794921525;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Date:From:To:Cc:
	 Subject:In-Reply-To:References:Message-ID:X-Sender:Content-Type:
	 Content-Transfer-Encoding:X-Last-TLS-Session-Version;
	bh=Mq6W0SJjV2XsZGqNGRaOoIh0Y0rXmbfMH2IslWU3UVU=;
	b=VTaZG42FdeGHjMVQ5yPJRdFDXC+p8sYfgvOvnEonyzBb0iozVNHZu7e2XXQ6yOO+Zxbu
	 YScGR0+KhbZHtWtwApmoNlefjskLPFRoi4iUtNvGraEiUzWzJk6KodUbtYurtVnXga143
	 8Ldki222QiOEZCww/Dw5J6RDCmxkG8ATR6loI2LSnwwTufXG6K0rTfq+vNG2L2O1QrTq3
	 Y0gKT6ye95KfAfg3QWVpxCUfgcsuCKWtWElA6ZFacMgcbdF6HwJs0nDFWe7fqiIr7pZjt
	 vkcgZ5KFHAr1a6sz2Ge6zaitedOZET9BzXJJiOB58XzuXVVghgVnmP1dU2Pj8d1P7lA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=CBaZuYf2;
	dmarc=none header.from=tipi-net.de;
	spf=pass smtp.mailfrom=tipi-net.de;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 94F5D606A897;
	Tue, 17 Nov 2026 13:18:45 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=CBaZuYf2
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=194.13.80.246
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794921524;
	b=EgYWdJHryl/Wmc7DcSmjTKmzwmqSBilkoTzcija9nCUh8BsADAg9XIgjK6xy+cYsIq/+
	 SXnKaz85EU4jmFAZ3czV626Y6kvnPUXlnOwxSgrd63M6KUlB0HKyJ34pU0Jm0tMFgTx1C
	 /DpNKKO0VwFY+pdqsTt44jEwvwCezKXRZz59iHc6dKhasx3BnqomJsC72A6LxOwjeO26o
	 ns8UMZYfTxB4HjP3ANVrlALRWlu4TCxiez6Gekq/4E27xpgbYhcAXvedfeSS+x71MlNP2
	 58k7c7W73hzVVvlB216IJr/Z2f69CuYYxKPoewJ6TV7kSmUpSayErYFoptawTofEibg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794921524;
	h=DMARC-Filter:Received:DKIM-Signature:MIME-Version:Date:From:To:Cc:
	 Subject:In-Reply-To:References:Message-ID:X-Sender:Content-Type:
	 Content-Transfer-Encoding:X-Last-TLS-Session-Version;
	bh=Mq6W0SJjV2XsZGqNGRaOoIh0Y0rXmbfMH2IslWU3UVU=;
	b=MQjGS79dopAVfLdOHdkyFOMwmcconqdbQlYIqC9AgPLxSYuz6kRQqPmROWzOwSPbBpnP
	 /b35vmaxs0WFRc13j70n8xa1sW5Ki1Ibn7JtSoOo20hLd+4OQZXdM61muNgXbVlSokIR+
	 eko1HSvyoPsQC4BlopA9EJKLurYMR0xcPCmZia6N7DuwoDcv1oprRLp1eFgwQKWDdt7uA
	 KGaONxyYp3iI88n0iE12YplyVfP3zKX7Tfps2aHKzSBq09fehSElu3L3FgZqGeoKI1Ea5
	 kCxWgv2MtTyov6WjKObeHfG0inMoIvbxNrm0/kYBhGUTPityEe09XtmeD2aFL8OcxeA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=tipi-net.de;
	spf=pass smtp.mailfrom=tipi-net.de;
	dkim=pass header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=CBaZuYf2;
	arc=none smtp.remote-ip=194.13.80.246
X-Received: from mail.tipi-net.de (mail.tipi-net.de [194.13.80.246])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B584606A887;
	Tue, 17 Nov 2026 13:18:44 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4B584606A887
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de
X-Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id C9770A0021;
	Tue, 17 Nov 2026 14:18:40 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim;
	t=1794921522; h=from:subject:date:message-id:to:cc:mime-version:content-type:
	 content-transfer-encoding:in-reply-to:references;
	bh=Mq6W0SJjV2XsZGqNGRaOoIh0Y0rXmbfMH2IslWU3UVU=;
	b=CBaZuYf2Jmkqul+6ohs43/H/0rXKbMHY8vJSrEFi2jXDPn8Qf/pjVEofkZdqUt538IRKRU
	QUFTuPr9B8yDUxvZCRM92n9adYYzTVTIb/eJT3FwTaNDX6u0tFBFpETDIHkD3WvFd3Uown
	8+Ue1IfL/9ILTBHzRu7uFrl51+b+V/ajP9xg01DIuiGmQHPUJB/YSt/to2MdeXM2Hljt/U
	JLUes1EguIeh5nAVCb3HSVfmyt0PZ5NBa7lo12iTkU35SWlTyUStWQX7vgwNw3jUnZY38D
	DIJoXtJnChkRphYQGz3D7Hpv9ZoEMy8nR6PPyyJH6WuEm27xx7Nqh4cZq7tr2w==
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-Cc: 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>,
 netdev@vger.kernel.org, linux-kernel@vger.kernel.org
X-In-Reply-To: <20261117-lan966x-rx-pages-tx-alloc-fail-v1-1-13f310d66650@microchip.com>
X-Sender: nb@tipi-net.de
X-Last-TLS-Session-Version: TLSv1.3