🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #2926

[PATCH net-next v2] net: stmmac: leave the datapath running for normal-size MTU changes

#2926
From: James Hilliard
Date: Tue, 13 Oct 2026 17:54
52 lines
10601 bytes
When both MTUs are at most ETH_DATA_LEN, the receive buffer size and MAC
receive limit do not change. Update the MTU without restarting the
datapath.

This also avoids rebinding a live AF_XDP pool to a temporary RXQ. XDP
rejects jumbo MTUs, so all supported XDP MTU changes take this path.
Jumbo transitions still use the existing reopen path.

Found by source review while working on the stmmac MTU/resume recovery
series. The fast path was tested on Allwinner H616 with sun8i EMAC1 and
an AC300 PHY. The AF_XDP scenario was identified by inspection.

Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
Changes in v2:
- Target net-next and drop the Fixes tag as requested by Jakub Kicinski.
- Clarify the standalone commit message and how the issue was found.
- Add Nicolai Buchwitz's Reviewed-by.
- No code changes.
- Link to v1: https://patch.msgid.link/20260930-stmmac-mtu-fastpath-v1-1-fd73f378c071@gmail.com
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 56d89a696272..50eaee656cfb 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -6257,7 +6257,12 @@ static int stmmac_change_mtu(struct net_device *dev, int new_mtu)
 	if ((txfifosz < new_mtu) || (new_mtu > BUF_SIZE_16KiB))
 		return -EINVAL;
 
-	if (netif_running(dev)) {
+	/* Normal-size frames use the same buffers and MAC receive limits.
+	 * In particular, do not disturb a live AF_XDP pool: XDP does not
+	 * support jumbo frames, so it never needs the ring replacement below.
+	 */
+	if (netif_running(dev) &&
+	    (dev->mtu > ETH_DATA_LEN || mtu > ETH_DATA_LEN)) {
 		netdev_dbg(priv->dev, "restarting interface to change its MTU\n");
 		/* Try to allocate the new DMA conf with the new mtu */
 		dma_conf = stmmac_setup_dma_desc(priv, mtu);

---
base-commit: 05b5019b01fb9443b09ae4ed34af1135a80a84c8
change-id: 20260930-stmmac-mtu-fastpath-68813ead3b90

Best regards,
--  
James Hilliard <james.hilliard1@gmail.com>
Technical Details
Message-ID: <20261013-stmmac-mtu-fastpath-v2-1-1e4ce8137689@gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-345768-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-345768-linux-kernel-netdev=dewy.ru
From: james.hilliard1@gmail.com (James Hilliard)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v2] net: stmmac: leave the datapath running for
 normal-size MTU changes
Date: Tue, 13 Oct 2026 11:54:13 -0600
Organization: Usenet Network
Message-ID: <20261013-stmmac-mtu-fastpath-v2-1-1e4ce8137689@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2152123"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:wefcLlQi5opozuzVao+bYF6WVqw= sha256:2NjAO2wZCYiFhPG+R+a6y2p6tK1G+4YS5BA+Lt0lujs=
	sha1:3ZzYvMaYU5q125xfwLTvCeYUxbg= sha256:LR4sIJWYgCVFAlNMHEkX1XJZCe2kyZlmDEzQgI69kOU=
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 CA07E10FF1B; Wed, 14 Oct 2026 00:03:23 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 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, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	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=gmail.com
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 dsHOUE1g3WYQ;
	Wed, 14 Oct 2026 00:03:20 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-345768-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id E91C710FF17; Wed, 14 Oct 2026 00:03:11 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sin.lore.kernel.org (Postfix) with ESMTP id D3BB4126E50; Tue, 13 Oct 2026 17:55:01 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id C0F5452ED39;
	Tue, 13 Oct 2026 17:54:18 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nZJQpuVm"
X-Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com [209.85.161.54])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id C890051A135
	for <netdev@vger.kernel.org>; Tue, 13 Oct 2026 17:54:16 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.54
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791914058; cv=none; b=FYggUt4JsW040HfsBmUzCbPePsXaI5JBoyyCFc3atMSY0VMrrNSBCZk7uS/FHMGX0lu3p4deuwjxfB0iXDekt0UeSeemndrHcnoG0C42fQPlm8WZdLtQictZzYw9/Tt/aiwQnrhpPhjeRJU+biF6D+ZM9Q88/hCzRxJze13Zb6A=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791914058; c=relaxed/simple;
	bh=0E6bGmEo1GwhFi1se4trHegbmcoiealEmKFcFtFcwB4=;
	h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=hrYl7utTMJZ8xPpahPqSbZq+BlS3Wn7HHiWKMfremjMfJuVkRk9Y51KjZo0Lkml1iIapsM198mHMOFjLdhNzP3IpLraHzaLNYudfZw6l4RN1mqgoOTpxxoDU06g3SBLL+kA1nbmI5NYMbG7qlbXrFI6WN32OeDhpiuX9oM7WwI8=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nZJQpuVm; arc=none smtp.client-ip=209.85.161.54
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-oo1-f54.google.com with SMTP id 006d021491bc7-6dcf573c429so2119874eaf.2
        for <netdev@vger.kernel.org>; Tue, 13 Oct 2026 10:54:16 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20251104; t=1791914055; x=1792518855; darn=vger.kernel.org;
        h=cc:to:message-id:content-transfer-encoding:content-type
         :mime-version:subject:date:from:from:to:cc:subject:date:message-id
         :reply-to:content-type;
        bh=AoNTFArShrIuErsfoUzGL9W/LuOVl703X8/dX7lKLJs=;
        b=nZJQpuVmLIblfd0MZMstN6RSp/LPMXj+IlHWCEmIYjKpfbEmjNTwt+JhMSVccHpMqf
         ab/qL4ATwbTkf+50Bv74dgSv/hoWNEgNrECasxaUCdnK+3Wqnn1Lwh08UAA543w2vIJU
         sx3CF78z28e9zYs9QhC78OshFMUSEHY1CcCzbbbftYEN44yORFyC5NV7Z5o4aaSYTULF
         51+a5wYhj50wPloxApLrQx1kLmE+OfvZG/bUtbBOETos/ACuQ3JPggSS+/b5SfFeg96l
         H7OxrVASQ1tId14jy29K1t7/QAIOFYonye9RGXpBZuGtwERbrckckF1rh+wPlGB8vZMK
         /mmw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1791914055; x=1792518855;
        h=cc:to:message-id:content-transfer-encoding:content-type
         :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to
         :cc:subject:date:message-id:reply-to:content-type;
        bh=AoNTFArShrIuErsfoUzGL9W/LuOVl703X8/dX7lKLJs=;
        b=cU//odyLeSEe71PLxXnHdyFJDu9FyAiu1MIJl2QitDjHqPlWtblE7j0A5/jcRkO6Yf
         9gizw1arZdnts5c/tiWykG6H7Ipynd4ciDz7ZTMUpVC/eDQw2Hj8NKixKJVDjjNRi8IC
         QC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X-Received: by 2002:a05:6820:a292:10b0:6f5:467a:aed2 with SMTP id 006d021491bc7-6f5467ab923mr3853137eaf.5.1791914055335;
        Tue, 13 Oct 2026 10:54:15 -0700 (PDT)
X-Received: from [127.0.1.1] (174-29-1-49.hlrn.qwest.net. [174.29.1.49])
        by smtp.gmail.com with ESMTPSA id 586e51a60fabf-4a6dfcabc34sm277356fac.15.2026.10.13.10.54.14
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Tue, 13 Oct 2026 10:54:14 -0700 (PDT)
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-B4-Tracking: v=1; b=H4sIAAAAAAAC/32OwW7DIBBEf8Xac6kWg2PIqf9R5bDgJUYqdgLES
 hX534vcnnscPc2beUHhHLnAuXtB5i2WuC4t9G8d+JmWK4s4tQw99ie0CkWpKZEXqT5EoFJvVGd
 xMkYqpkk5i9Cat8whPg/rJyxcxcLPCpdfkvn+aDP1DzsqLPyaUqznDgc3oLQOZXBWa+XQEmuel
 KYgpRrIIBntzeGaY6lr/j6ub/KQ/ftyk0KKMI0qqNF4HOXHNVH8em/jcNn3/QcZJUMJDAEAAA=
 =
X-Change-ID: 20260930-stmmac-mtu-fastpath-68813ead3b90
X-Cc: "David S. Miller" <davem@davemloft.net>, 
 linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, 
 Nicolai Buchwitz <nb@tipi-net.de>, 
 James Hilliard <james.hilliard1@gmail.com>
X-Mailer: b4 0.15.2