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 --- 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