From nobody Wed Apr 1 22:20:19 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50ABC4779B3 for ; Wed, 1 Apr 2026 16:39:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775061598; cv=none; b=NUfx2sZh5J77Oj6+X+voA+NWLYmBlZiTBDzoAqlvWD/Aevc7TbKHnnFT3tuoix+C7xdi7JE3TGISDOzeWtMqHGbqm9vAWDvzeVSaNhUTq5aSCZqcA/X4RpVa/SykL8lo69e53n1TQ5vo4MEiPuNhiSZw0d3ownh6vPaTiWXPKAE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775061598; c=relaxed/simple; bh=vsBwCme8KJvf6E7ASjBFpFWkYjm4KVrMJftP/zq2PjM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kdmlsixT2tRR/XRUMEhstSqNvyrbGBNoeL4Xzs27/AfhSHgMvZXl+mnrcH/YVwRxCDOuCXaDmTHGl12GrF98n3+RAW7okL14zXcWIZ+T3mVi+TxsFaNa5gRGAr1lFYp4TSVDhVlspkBgAwuI78itS60VB2+bIgYkJ3SIxWufTyY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=V/8bmKlK; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="V/8bmKlK" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 5CBAFC5996E; Wed, 1 Apr 2026 16:40:21 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 497E6602BF; Wed, 1 Apr 2026 16:39:50 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id DEE7610450A10; Wed, 1 Apr 2026 18:39:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1775061589; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=4y1czYbIcSgISGAdHVLbVNE8ycNyrwxMXKBVsQfa3wE=; b=V/8bmKlKCoUKoRRtGcCeocLSmadXKqohQL/hSgyTEBhjNJ6JAoJwm27zuwEV6nEzk7EfTe VFU9OuUN7R0M2amBgr2S6TXudMmUWSCPLo3iuKk8GOZXiweh+Pvd/wQYUYSt++g1Jqu/pA NVs9esUAwJk8yu9Fw5HHeub/4DO57Rw7AVaWwSspHw/mY+cLkF2XVXmL0C6AIazVqy3Ng1 MJDuilhOTP8lt1MPjrjoj/63Jiz+dbSKzFEm//6+VCi6CUvLgZc+SmnQiWrSAl2UpzbAEv E0+A/YIEUK1Iycfs5Nsbx6ssSXCDMisxpepmzAVwUDiKu3VKSxlp1Lt523/KPQ== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Wed, 01 Apr 2026 18:39:14 +0200 Subject: [PATCH net-next 11/11] net: macb: use context swapping in .ndo_change_mtu() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260401-macb-context-v1-11-9590c5ab7272@bootlin.com> References: <20260401-macb-context-v1-0-9590c5ab7272@bootlin.com> In-Reply-To: <20260401-macb-context-v1-0-9590c5ab7272@bootlin.com> To: Nicolas Ferre , Claudiu Beznea , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , Russell King Cc: Paolo Valerio , Conor Dooley , Nicolai Buchwitz , Vladimir Kondratiev , Gregory CLEMENT , =?utf-8?q?Beno=C3=AEt_Monin?= , Tawfik Bayouk , Thomas Petazzoni , Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.15.0 X-Last-TLS-Session-Version: TLSv1.3 Use newly introduced context buffer management to implement .ndo_change_mtu() as a context swap: allocate new context -> reconfigure HW -> free old context. This resists memory pressure well by failing without closing the interface and it is much faster by avoiding PHY reinit. Signed-off-by: Th=C3=A9o Lebrun --- drivers/net/ethernet/cadence/macb_main.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index 543356554c11..e10791bf1f4d 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -3438,11 +3438,25 @@ static int macb_close(struct net_device *netdev) =20 static int macb_change_mtu(struct net_device *netdev, int new_mtu) { - if (netif_running(netdev)) - return -EBUSY; + struct macb *bp =3D netdev_priv(netdev); + bool running =3D netif_running(netdev); + struct macb_context *new_ctx; + + if (running) { + new_ctx =3D macb_context_alloc(bp, new_mtu, + bp->configured_rx_ring_size, + bp->configured_tx_ring_size); + if (IS_ERR(new_ctx)) + return PTR_ERR(new_ctx); + + macb_context_swap_start(bp); + } =20 WRITE_ONCE(netdev->mtu, new_mtu); =20 + if (running) + macb_context_swap_end(bp, new_ctx); + return 0; } =20 --=20 2.53.0