Subject: Re: [PATCH net-next] net: macb: allow MTU changes while the interface is running

From: Breno Leitao <[email-masked]>
Date: Tue, 17 Mar 2026 12:42:04 -0700

On Mon, Mar 16, 2026 at 10:27:20AM +0100, 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.
> 
> 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 <[email-masked]>
> ---
>  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);

Would you like to keep the new_mtu set, even if macb_open() fails?

Other than that, it looks good to me.
--breno