All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Jarod Wilson <jarod@redhat.com>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: Minimum MTU Mess
Date: Wed, 7 Sep 2016 22:31:12 +0200	[thread overview]
Message-ID: <20160907203112.GA26445@lunn.ch> (raw)
In-Reply-To: <20160907195356.GX33916@redhat.com>

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

  reply	other threads:[~2016-09-07 20:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-02 17:07 Minimum MTU Mess Jarod Wilson
2016-09-06 16:50 ` [PATCH net-next] sfc: check MTU against minimum threshold Bert Kenward
2016-09-06 21:31   ` Jarod Wilson
2016-09-06 23:54   ` David Miller
2016-09-06 23:55 ` Minimum MTU Mess David Miller
2016-09-07 19:53   ` Jarod Wilson
2016-09-07 20:31     ` Andrew Lunn [this message]
2016-09-07 23:43       ` Jarod Wilson
2016-09-08  1:24         ` Andrew Lunn
2016-09-09 18:05           ` Jarod Wilson
2016-09-12  2:41             ` Andrew Lunn
2016-09-12 14:27               ` Jarod Wilson
2016-09-07 20:35     ` Stephen Hemminger
2016-09-07 23:44       ` Jarod Wilson
2016-09-12  2:59     ` YOSHIFUJI Hideaki
2016-09-12 14:31       ` Jarod Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160907203112.GA26445@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=jarod@redhat.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.