netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kodanev <alexey.kodanev@oracle.com>
To: netdev@vger.kernel.org
Cc: David Miller <davem@davemloft.net>,
	Alexey Kodanev <alexey.kodanev@oracle.com>
Subject: [PATCH net-next 3/4] geneve: check MTU for a minimum in geneve_change_mtu()
Date: Thu, 19 Apr 2018 15:42:31 +0300	[thread overview]
Message-ID: <1524141752-25789-4-git-send-email-alexey.kodanev@oracle.com> (raw)
In-Reply-To: <1524141752-25789-1-git-send-email-alexey.kodanev@oracle.com>

geneve_change_mtu() will be used not only as ndo_change_mtu() callback,
but also to verify a user specified MTU on a new link creation in the
next patch.

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 drivers/net/geneve.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index b650f84..ae649f6 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -942,11 +942,10 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev)
 
 static int geneve_change_mtu(struct net_device *dev, int new_mtu)
 {
-	/* Only possible if called internally, ndo_change_mtu path's new_mtu
-	 * is guaranteed to be between dev->min_mtu and dev->max_mtu.
-	 */
 	if (new_mtu > dev->max_mtu)
 		new_mtu = dev->max_mtu;
+	else if (new_mtu < dev->min_mtu)
+		new_mtu = dev->min_mtu;
 
 	dev->mtu = new_mtu;
 	return 0;
-- 
1.8.3.1

  parent reply	other threads:[~2018-04-19 12:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-19 12:42 [PATCH net-next 0/4] geneve: verify user specified MTU or adjust with a lower device Alexey Kodanev
2018-04-19 12:42 ` [PATCH net-next 1/4] geneve: remove white-space before '#if IS_ENABLED(CONFIG_IPV6)' Alexey Kodanev
2018-04-19 12:42 ` [PATCH net-next 2/4] geneve: cleanup hard coded value for Ethernet header length Alexey Kodanev
2018-04-19 12:42 ` Alexey Kodanev [this message]
2018-04-19 12:42 ` [PATCH net-next 4/4] geneve: configure MTU based on a lower device Alexey Kodanev
2018-04-20 15:19 ` [PATCH net-next 0/4] geneve: verify user specified MTU or adjust with " David Miller

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=1524141752-25789-4-git-send-email-alexey.kodanev@oracle.com \
    --to=alexey.kodanev@oracle.com \
    --cc=davem@davemloft.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).