[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <10569cc5-1624-4edf-88b9-ec9110c11890@kernel.org>
Date: Sat, 16 Dec 2023 11:19:46 -0700
From: David Ahern <dsahern@...nel.org>
To: Graeme Smecher <gsmecher@...eespeedlogic.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
claudiu.beznea@...on.dev, nicolas.ferre@...rochip.com, mdf@...nel.org
Subject: Re: [PATCH] RFC: net: ipconfig: temporarily bring interface down when
changing MTU.
On 12/15/23 5:04 PM, Graeme Smecher wrote:
\> diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
> index c56b6fe6f0d7..69c2a41393a0 100644
> --- a/net/ipv4/ipconfig.c
> +++ b/net/ipv4/ipconfig.c
> @@ -396,9 +396,21 @@ static int __init ic_setup_if(void)
> */
> if (ic_dev_mtu != 0) {
> rtnl_lock();
> - if ((err = dev_set_mtu(ic_dev->dev, ic_dev_mtu)) < 0)
> - pr_err("IP-Config: Unable to set interface mtu to %d (%d)\n",
> - ic_dev_mtu, err);
> + /* Some Ethernet adapters only allow MTU to change when down. */
> + if((err = dev_change_flags(ic_dev->dev, ic_dev->dev->flags | IFF_UP, NULL)))
IFF_UP?
> + pr_err("IP-Config: About to set MTU, but failed to "
> + "bring interface %s down! (%d)\n",
> + ic_dev->dev->name, err);
> + else {
> + if ((err = dev_set_mtu(ic_dev->dev, ic_dev_mtu)) < 0)
try to set the MTU even if DOWN fails otherwise a regression.
> + pr_err("IP-Config: Unable to set interface mtu to %d (%d)\n",
> + ic_dev_mtu, err);
> +
> + if((err = dev_change_flags(ic_dev->dev, ic_dev->dev->flags | IFF_UP, NULL)))
> + pr_err("IP-Config: Trying to set MTU, but unable "
> + "to bring interface %s back up! (%d)\n",
This step is not "trying to set MTU"; the last one did:
pr_err("IP-Config: Failed to bring interface %s up after changing MTU
(%d)\n",
> + ic_dev->dev->name, err);
> + }
> rtnl_unlock();
> }
> return 0;
Powered by blists - more mailing lists