netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonas Bonn <jonas@norrbonn.se>
To: laforge@gnumonks.org, kuba@kernel.org, netdev@vger.kernel.org,
	pablo@netfilter.org
Cc: Jonas Bonn <jonas@norrbonn.se>
Subject: [PATCH net-next v2 2/7] gtp: set initial MTU
Date: Wed,  3 Feb 2021 08:08:00 +0100	[thread overview]
Message-ID: <20210203070805.281321-3-jonas@norrbonn.se> (raw)
In-Reply-To: <20210203070805.281321-1-jonas@norrbonn.se>

The GTP link is brought up with a default MTU of zero.  This can lead to
some rather unexpected behaviour for users who are more accustomed to
interfaces coming online with reasonable defaults.

This patch sets an initial MTU for the GTP link of 1500 less worst-case
tunnel overhead.

Signed-off-by: Jonas Bonn <jonas@norrbonn.se>
Acked-by: Harald Welte <laforge@gnumonks.org>
---
 drivers/net/gtp.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
index 4c04e271f184..5a048f050a9c 100644
--- a/drivers/net/gtp.c
+++ b/drivers/net/gtp.c
@@ -612,11 +612,16 @@ static const struct net_device_ops gtp_netdev_ops = {
 
 static void gtp_link_setup(struct net_device *dev)
 {
+	unsigned int max_gtp_header_len = sizeof(struct iphdr) +
+					  sizeof(struct udphdr) +
+					  sizeof(struct gtp0_header);
+
 	dev->netdev_ops		= &gtp_netdev_ops;
 	dev->needs_free_netdev	= true;
 
 	dev->hard_header_len = 0;
 	dev->addr_len = 0;
+	dev->mtu = ETH_DATA_LEN - max_gtp_header_len;
 
 	/* Zero header length. */
 	dev->type = ARPHRD_NONE;
@@ -626,11 +631,7 @@ static void gtp_link_setup(struct net_device *dev)
 	dev->features	|= NETIF_F_LLTX;
 	netif_keep_dst(dev);
 
-	/* Assume largest header, ie. GTPv0. */
-	dev->needed_headroom	= LL_MAX_HEADER +
-				  sizeof(struct iphdr) +
-				  sizeof(struct udphdr) +
-				  sizeof(struct gtp0_header);
+	dev->needed_headroom	= LL_MAX_HEADER + max_gtp_header_len;
 }
 
 static int gtp_hashtable_new(struct gtp_dev *gtp, int hsize);
-- 
2.27.0


  parent reply	other threads:[~2021-02-03  7:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02  6:51 [PATCH net-next 0/7] GTP Jonas Bonn
2021-02-02  6:51 ` [PATCH net-next 1/7] Revert "GTP: add support for flow based tunneling API" Jonas Bonn
2021-02-02  6:51 ` [PATCH net-next 2/7] gtp: set initial MTU Jonas Bonn
2021-02-02  6:51 ` [PATCH net-next 3/7] gtp: include role in link info Jonas Bonn
2021-02-02  6:51 ` [PATCH net-next 4/7] gtp: really check namespaces before xmit Jonas Bonn
2021-02-02  6:51 ` [PATCH net-next 5/7] gtp: drop unnecessary call to skb_dst_drop Jonas Bonn
2021-02-02  6:51 ` [PATCH net-next 6/7] gtp: set device type Jonas Bonn
2021-02-02  6:51 ` [PATCH net-next 7/7] gtp: update rx_length_errors for abnormally short packets Jonas Bonn
2021-02-02 22:00   ` Jakub Kicinski
2021-02-03  7:07 ` [PATCH net-next v2 0/7] GTP Jonas Bonn
2021-02-03  7:07   ` [PATCH net-next v2 1/7] Revert "GTP: add support for flow based tunneling API" Jonas Bonn
2021-02-03  7:08   ` Jonas Bonn [this message]
2021-02-03  7:08   ` [PATCH net-next v2 3/7] gtp: include role in link info Jonas Bonn
2021-02-03  7:08   ` [PATCH net-next v2 4/7] gtp: really check namespaces before xmit Jonas Bonn
2021-02-03  7:08   ` [PATCH net-next v2 5/7] gtp: drop unnecessary call to skb_dst_drop Jonas Bonn
2021-02-03  7:08   ` [PATCH net-next v2 6/7] gtp: set device type Jonas Bonn
2021-02-03  7:08   ` [PATCH net-next v2 7/7] gtp: update rx_length_errors for abnormally short packets Jonas Bonn
2021-02-03 20:19   ` [PATCH net-next v2 0/7] GTP Jakub Kicinski
2021-02-04 20:10   ` Jakub Kicinski
2021-02-04  6:09 ` [PATCH net-next " Pravin Shelar

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=20210203070805.281321-3-jonas@norrbonn.se \
    --to=jonas@norrbonn.se \
    --cc=kuba@kernel.org \
    --cc=laforge@gnumonks.org \
    --cc=netdev@vger.kernel.org \
    --cc=pablo@netfilter.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).