[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160907203112.GA26445@lunn.ch>
Date: Wed, 7 Sep 2016 22:31:12 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Jarod Wilson <jarod@...hat.com>
Cc: David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: Minimum MTU Mess
Hi Jarod
> - /* MTU must be positive. */
> - if (new_mtu < 0)
> + if (new_mtu < dev->min_mtu) {
> + netdev_err(dev, "Invalid MTU %d requested, hw min %d\n",
> + new_mtu, dev->min_mtu);
> return -EINVAL;
> + }
> +
> + if (new_mtu > dev->max_mtu) {
> + netdev_err(dev, "Invalid MTU %d requested, hw max %d\n",
> + new_mtu, dev->min_mtu);
> + return -EINVAL;
> + }
I doubt you can make such a big change like this in one go. Can you
really guarantee all interfaces, of what ever type, will have some
value for dev->min_mtu and dev->max_mtu? What may fly is something
more like:
> + if (dev->max_mtu && new_mtu > dev->max_mtu) {
> + netdev_err(dev, "Invalid MTU %d requested, hw max %d\n",
> + new_mtu, dev->min_mtu);
> + return -EINVAL;
> + }
Maybe in a few cycles you can add a WARN_ON(!dev->max_mtu), and a few
cycles after that go with (new_mtu > dev->max_mtu).
Andrew
Powered by blists - more mailing lists