public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolai Buchwitz <nb@tipi-net.de>
To: "Théo Lebrun" <theo.lebrun@bootlin.com>
Cc: nicolas.ferre@microchip.com, claudiu.beznea@tuxon.dev,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org
Subject: Re: [PATCH net-next] net: macb: allow MTU changes while the interface is running
Date: Tue, 17 Mar 2026 20:31:10 +0100	[thread overview]
Message-ID: <1175cc7425e073a0b8b84b2da04ee1b1@tipi-net.de> (raw)
In-Reply-To: <DH57URLYG3TU.B4HGNJATLFMU@bootlin.com>

Hi Théo

Thanks for the review and testing!

On 17.3.2026 18:00, Théo Lebrun wrote:
> Hello Nicolai,
> 
> On Mon Mar 16, 2026 at 10:27 AM CET, Nicolai Buchwitz wrote:
>> 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.
> 
> One valid reasoning for making the operation return -EBUSY is that
> macb_close() will lead to packet loss for a few seconds. Users might
> not expect an MTU change to trigger that. -EBUSY means user (be it
> human or software) becomes aware and has time for a second thought.
> 
> But clearly, it becomes annoying as the user in the long run, when you
> own your platform and know the implications.

Since setting the MTU already requires elevated rights and usually 
involves reconfiguring surrounding infrastructure that may also drop 
packets, I think the better UX is worth the brief interruption.

> 
>> 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;
>>  }
> 
> Reviewed-by: Théo Lebrun <theo.lebrun@bootlin.com>
> Tested-by: Théo Lebrun <theo.lebrun@bootlin.com> # on eyeq5-epm
> 
> Thanks,
> 
> --
> Théo Lebrun, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

Cheers
Nicolai

  reply	other threads:[~2026-03-17 19:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=1175cc7425e073a0b8b84b2da04ee1b1@tipi-net.de \
    --to=nb@tipi-net.de \
    --cc=andrew+netdev@lunn.ch \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=pabeni@redhat.com \
    --cc=theo.lebrun@bootlin.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