netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Herbert <tom@herbertland.com>
To: <davem@davemloft.net>, <netdev@vger.kernel.org>
Cc: <kernel-team@fb.com>
Subject: [PATCH net-next 6/7] ipv6: Generic tunnel cleanup
Date: Fri, 29 Apr 2016 17:12:20 -0700	[thread overview]
Message-ID: <1461975141-954269-7-git-send-email-tom@herbertland.com> (raw)
In-Reply-To: <1461975141-954269-1-git-send-email-tom@herbertland.com>

A few generic changes to generalize tunnels in IPv6:
  - Export ip6_tnl_change_mtu so that it can be called by ip6_gre
  - Add tun_hlen to ip6_tnl structure.

Signed-off-by: Tom Herbert <tom@herbertland.com>
---
 include/net/ip6_tunnel.h | 5 ++++-
 net/ipv6/ip6_tunnel.c    | 7 +++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index 835491b..fb9e015 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -50,8 +50,10 @@ struct ip6_tnl {
 	/* These fields used only by GRE */
 	__u32 i_seqno;	/* The last seen seqno	*/
 	__u32 o_seqno;	/* The last output seqno */
-	int hlen;       /* Precalculated GRE header length */
+	int hlen;       /* tun_hlen + encap_hlen */
+	int tun_hlen;	/* Precalculated header length */
 	int mlink;
+
 };
 
 /* Tunnel encapsulation limit destination sub-option */
@@ -76,6 +78,7 @@ __u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr,
 			     const struct in6_addr *raddr);
 struct net *ip6_tnl_get_link_net(const struct net_device *dev);
 int ip6_tnl_get_iflink(const struct net_device *dev);
+int ip6_tnl_change_mtu(struct net_device *dev, int new_mtu);
 
 #ifdef CONFIG_INET
 static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb,
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index b1f31d2..ade55af 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1540,8 +1540,7 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
  *   %-EINVAL if mtu too small
  **/
 
-static int
-ip6_tnl_change_mtu(struct net_device *dev, int new_mtu)
+int ip6_tnl_change_mtu(struct net_device *dev, int new_mtu)
 {
 	struct ip6_tnl *tnl = netdev_priv(dev);
 
@@ -1557,6 +1556,7 @@ ip6_tnl_change_mtu(struct net_device *dev, int new_mtu)
 	dev->mtu = new_mtu;
 	return 0;
 }
+EXPORT_SYMBOL(ip6_tnl_change_mtu);
 
 int ip6_tnl_get_iflink(const struct net_device *dev)
 {
@@ -1632,6 +1632,9 @@ ip6_tnl_dev_init_gen(struct net_device *dev)
 	if (ret)
 		goto destroy_dst;
 
+	t->hlen = 0;
+	t->tun_hlen = 0;
+
 	return 0;
 
 destroy_dst:
-- 
2.8.0.rc2

  parent reply	other threads:[~2016-04-30  0:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-30  0:12 [PATCH next-next 0/7] net: Cleanup IPv6 ip tunnels Tom Herbert
2016-04-30  0:12 ` [PATCH next-next 1/7] ipv6: Cleanup IPv6 tunnel receive path Tom Herbert
2016-04-30  0:12 ` [PATCH next-next 2/7] gre: Move utility functions to common headers Tom Herbert
2016-05-03 11:29   ` Jiri Benc
2016-05-04  4:53     ` David Miller
2016-05-04  8:35       ` Jiri Benc
2016-05-04 16:45         ` David Miller
2016-04-30  0:12 ` [PATCH next-next 3/7] gre6: Cleanup GREv6 receive path, call common GRE functions Tom Herbert
2016-04-30  0:12 ` [PATCH next-next 4/7] ipv6: Create ip6_tnl_xmit Tom Herbert
2016-04-30  0:12 ` [PATCH next-next 5/7] gre: Create common functions for transmit Tom Herbert
2016-04-30  0:12 ` Tom Herbert [this message]
2016-04-30  0:12 ` [PATCH next-next 7/7] gre6: Cleanup GREv6 transmit path, call common GRE functions Tom Herbert
2016-04-30  1:00 ` [PATCH next-next 0/7] net: Cleanup IPv6 ip tunnels Alexander Duyck
2016-05-02 19:32   ` Tom Herbert
2016-05-02 19:42     ` Alexander Duyck
2016-05-02 23:23 ` David Miller
2016-05-03  2:03 ` Alexander Duyck

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=1461975141-954269-7-git-send-email-tom@herbertland.com \
    --to=tom@herbertland.com \
    --cc=davem@davemloft.net \
    --cc=kernel-team@fb.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 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).