public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: macb: allow MTU changes while the interface is running
@ 2026-03-16  9:27 Nicolai Buchwitz
  2026-03-17 17:00 ` Théo Lebrun
  2026-03-17 19:42 ` Breno Leitao
  0 siblings, 2 replies; 14+ messages in thread
From: Nicolai Buchwitz @ 2026-03-16  9:27 UTC (permalink / raw)
  To: nicolas.ferre, claudiu.beznea
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
	Nicolai Buchwitz

macb_change_mtu() currently returns -EBUSY if the interface is running,
requiring users to bring the interface down before changing the MTU. This
is unnecessarily restrictive.

Instead, close and reopen the interface around the MTU change so that RX
DMA buffers are reallocated for the new MTU. This is the same approach
used by many other network drivers (e.g. igb, tg3, stmmac).

Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
 drivers/net/ethernet/cadence/macb_main.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 5e27e0e87a55..8dd01031250d 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -3262,11 +3262,16 @@ static int macb_close(struct net_device *dev)
 
 static int macb_change_mtu(struct net_device *dev, int new_mtu)
 {
-	if (netif_running(dev))
-		return -EBUSY;
+	bool was_running = netif_running(dev);
+
+	if (was_running)
+		macb_close(dev);
 
 	WRITE_ONCE(dev->mtu, new_mtu);
 
+	if (was_running)
+		return macb_open(dev);
+
 	return 0;
 }
 
-- 
2.51.0


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

end of thread, other threads:[~2026-03-18 22:13 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-16  9:27 [PATCH net-next] net: macb: allow MTU changes while the interface is running Nicolai Buchwitz
2026-03-17 17:00 ` Théo Lebrun
2026-03-17 19:31   ` Nicolai Buchwitz
2026-03-17 22:23   ` Jakub Kicinski
2026-03-17 22:58     ` Nicolai Buchwitz
2026-03-17 23:23       ` Jakub Kicinski
2026-03-18  9:53         ` Théo Lebrun
2026-03-18 11:25           ` Nicolai Buchwitz
2026-03-18 14:33             ` Théo Lebrun
2026-03-18 22:13           ` Jakub Kicinski
2026-03-17 19:42 ` Breno Leitao
2026-03-17 19:47   ` Breno Leitao
2026-03-17 20:11     ` Nicolai Buchwitz
2026-03-17 20:04   ` Nicolai Buchwitz

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