Re: [PATCH net-next] net: macb: allow MTU change when the interface is up

From: Simon Horman
Date: Tue Mar 26 2024 - 05:39:44 EST


On Tue, Mar 26, 2024 at 09:49:19AM +0100, Thomas Perrot wrote:
> Hello,
>
> On Mon, 2024-03-25 at 18:56 -0700, Jakub Kicinski wrote:
> > On Mon, 25 Mar 2024 20:54:01 +0000 Simon Horman wrote:
> > > I'm not sure that it is expected behaviour for an interface
> > > to reset like this when a change of MTU is requested.
> > > While conversely I think it is common (if not entirely desirable)
> > > to prohibit changing the MTU when an interface is up.
> > > What is the problem being addressed here?
> >
>
> The problem being addressed here, is that NetworkManager isn't able to
> apply the MTU value set in the connection configuration file because
> the link is already up, then the change_mtu callback returns an error:
>
> "NetworkManager[412]: <debug> [1709629970.1735] platform: (eth0) link:
> setting mtu 1400
> NetworkManager[412]: <trace> [1709629970.1737] platform-linux: delayed-
> action: schedule wait-for-response-rtnl (seq 41, timeout in
> 0.199992796, response-type 0)
> NetworkManager[412]: <trace> [1709629970.1737] platform-linux: delayed-
> action: schedule refresh-link (ifindex 2)
> NetworkManager[412]: <trace> [1709629970.1738] platform-linux: delayed-
> action: handle refresh-link (ifindex 2)
> NetworkManager[412]: <debug> [1709629970.1738] platform-linux: do-
> request-link: 2
> NetworkManager[412]: <trace> [1709629970.1739] platform-linux: rtnl:
> recvmsg: new message NLMSG_ERROR, flags 0, seq 41
> NetworkManager[412]: <debug> [1709629970.1740] platform-linux: rtnl:
> recvmsg: error message from kernel: Device or resource busy (-16) for
> request 41"

Hi Thomas,

I understand this is not ideal. But from a driver level perspective, if the
HW doesn't support changing the MTU while the device is up, rejecting the
change MTU operation is actually the best practice (or least worst
depending on your perspective).

As Jakub pointed out elsewhere in this thread, with your proposed change,
there is a real chance the NIC could drop of the network entirely and not
come back. Whereas the expected outcome is for the NIC to remain on the
network with either the new or old MTU.