[PATCH net-next 0/3] lwtunnel, mpls fragmentation and gso fixes

STALE3657d

10 messages, 4 authors, 2016-08-11 · open the first message on its own page

[PATCH net-next 0/3] lwtunnel, mpls fragmentation and gso fixes

From: Roopa Prabhu <hidden>
Date: 2016-08-11 06:50:09

From: Roopa Prabhu <redacted>

This series fixes a few issues around mtu and fragmentation
for tunnels using lwtunnel output redirect and also fixes
a few gso issues recently reported by Lennert Buytenhek.

David Ahern (2):
  net: mpls fixes for GSO
  net: veth: set features for MPLS

Roopa Prabhu (1):
  lwtunnel: xmit redirect

 drivers/net/veth.c       |  1 +
 include/net/lwtunnel.h   | 44 ++++++++++++++++++++++++++++++++++++++++++++
 net/core/lwtunnel.c      | 35 +++++++++++++++++++++++++++++++++++
 net/ipv4/ip_output.c     |  8 ++++++++
 net/ipv4/route.c         |  4 +++-
 net/ipv6/ip6_output.c    |  8 ++++++++
 net/ipv6/route.c         |  4 +++-
 net/mpls/mpls_gso.c      | 24 ++++++++++++++++--------
 net/mpls/mpls_iptunnel.c | 16 ++++++++++++----
 9 files changed, 130 insertions(+), 14 deletions(-)

-- 
1.9.1

[PATCH net-next 1/3] lwtunnel: xmit redirect

From: Roopa Prabhu <hidden>
Date: 2016-08-11 06:50:01

From: Roopa Prabhu <redacted>

Today mpls iptunnel lwtunnel_output redirect expects the tunnel
output function to handle fragmentation. This is ok but can be
avoided if we did not do the mpls output redirect too early.
ie we could wait until ip fragmentation is done and then call
mpls output for each ip fragment.

To make this work we will need,
1) the lwtunnel state to carry encap headroom
2) and do the redirect to the encap output handler on the ip fragment
(essentially do the output redirect after fragmentation)

This patch adds tunnel headroom in lwtstate to make
sure we account for tunnel data in mtu calculations during fragmentation
and adds new xmit redirect handler to redirect to lwtunnel xmit func
after ip fragmentation.

This includes IPV6 and some mtu fixes and testing from David Ahern.

Signed-off-by: Roopa Prabhu <redacted>
Signed-off-by: David Ahern <redacted>
---
 include/net/lwtunnel.h   | 44 ++++++++++++++++++++++++++++++++++++++++++++
 net/core/lwtunnel.c      | 35 +++++++++++++++++++++++++++++++++++
 net/ipv4/ip_output.c     |  8 ++++++++
 net/ipv4/route.c         |  4 +++-
 net/ipv6/ip6_output.c    |  8 ++++++++
 net/ipv6/route.c         |  4 +++-
 net/mpls/mpls_iptunnel.c |  9 +++++----
 7 files changed, 106 insertions(+), 6 deletions(-)
diff --git a/include/net/lwtunnel.h b/include/net/lwtunnel.h
index e9f116e..60b5808 100644
--- a/include/net/lwtunnel.h
+++ b/include/net/lwtunnel.h
@@ -13,6 +13,13 @@
 /* lw tunnel state flags */
 #define LWTUNNEL_STATE_OUTPUT_REDIRECT	BIT(0)
 #define LWTUNNEL_STATE_INPUT_REDIRECT	BIT(1)
+#define LWTUNNEL_STATE_XMIT_REDIRECT	BIT(2)
+
+enum {
+	LWTUNNEL_XMIT_DONE,
+	LWTUNNEL_XMIT_CONTINUE,
+};
+
 
 struct lwtunnel_state {
 	__u16		type;
@@ -21,6 +28,7 @@ struct lwtunnel_state {
 	int		(*orig_output)(struct net *net, struct sock *sk, struct sk_buff *skb);
 	int		(*orig_input)(struct sk_buff *);
 	int             len;
+	__u16		headroom;
 	__u8            data[0];
 };
 
@@ -34,6 +42,7 @@ struct lwtunnel_encap_ops {
 			  struct lwtunnel_state *lwtstate);
 	int (*get_encap_size)(struct lwtunnel_state *lwtstate);
 	int (*cmp_encap)(struct lwtunnel_state *a, struct lwtunnel_state *b);
+	int (*xmit)(struct sk_buff *skb);
 };
 
 #ifdef CONFIG_LWTUNNEL
@@ -75,6 +84,24 @@ static inline bool lwtunnel_input_redirect(struct lwtunnel_state *lwtstate)
 
 	return false;
 }
+
+static inline bool lwtunnel_xmit_redirect(struct lwtunnel_state *lwtstate)
+{
+	if (lwtstate && (lwtstate->flags & LWTUNNEL_STATE_XMIT_REDIRECT))
+		return true;
+
+	return false;
+}
+
+static inline unsigned int lwtunnel_headroom(struct lwtunnel_state *lwtstate,
+					     unsigned int mtu)
+{
+	if (lwtunnel_xmit_redirect(lwtstate) && lwtstate->headroom < mtu)
+		return lwtstate->headroom;
+
+	return 0;
+}
+
 int lwtunnel_encap_add_ops(const struct lwtunnel_encap_ops *op,
 			   unsigned int num);
 int lwtunnel_encap_del_ops(const struct lwtunnel_encap_ops *op,
@@ -90,6 +117,7 @@ struct lwtunnel_state *lwtunnel_state_alloc(int hdr_len);
 int lwtunnel_cmp_encap(struct lwtunnel_state *a, struct lwtunnel_state *b);
 int lwtunnel_output(struct net *net, struct sock *sk, struct sk_buff *skb);
 int lwtunnel_input(struct sk_buff *skb);
+int lwtunnel_xmit(struct sk_buff *skb);
 
 #else
 
@@ -117,6 +145,17 @@ static inline bool lwtunnel_input_redirect(struct lwtunnel_state *lwtstate)
 	return false;
 }
 
+static inline bool lwtunnel_xmit_redirect(struct lwtunnel_state *lwtstate)
+{
+	return false;
+}
+
+static inline unsigned int lwtunnel_headroom(struct lwtunnel_state *lwtstate,
+					     unsigned int mtu)
+{
+	return 0;
+}
+
 static inline int lwtunnel_encap_add_ops(const struct lwtunnel_encap_ops *op,
 					 unsigned int num)
 {
@@ -170,6 +209,11 @@ static inline int lwtunnel_input(struct sk_buff *skb)
 	return -EOPNOTSUPP;
 }
 
+static inline int lwtunnel_xmit(struct sk_buff *skb, u32 *status)
+{
+	return -EOPNOTSUPP;
+}
+
 #endif /* CONFIG_LWTUNNEL */
 
 #define MODULE_ALIAS_RTNL_LWT(encap_type) MODULE_ALIAS("rtnl-lwt-" __stringify(encap_type))
diff --git a/net/core/lwtunnel.c b/net/core/lwtunnel.c
index 669ecc9..e5f84c2 100644
--- a/net/core/lwtunnel.c
+++ b/net/core/lwtunnel.c
@@ -251,6 +251,41 @@ drop:
 }
 EXPORT_SYMBOL(lwtunnel_output);
 
+int lwtunnel_xmit(struct sk_buff *skb)
+{
+	struct dst_entry *dst = skb_dst(skb);
+	const struct lwtunnel_encap_ops *ops;
+	struct lwtunnel_state *lwtstate;
+	int ret = -EINVAL;
+
+	if (!dst)
+		goto drop;
+
+	lwtstate = dst->lwtstate;
+
+	if (lwtstate->type == LWTUNNEL_ENCAP_NONE ||
+	    lwtstate->type > LWTUNNEL_ENCAP_MAX)
+		return 0;
+
+	ret = -EOPNOTSUPP;
+	rcu_read_lock();
+	ops = rcu_dereference(lwtun_encaps[lwtstate->type]);
+	if (likely(ops && ops->xmit))
+		ret = ops->xmit(skb);
+	rcu_read_unlock();
+
+	if (ret == -EOPNOTSUPP)
+		goto drop;
+
+	return ret;
+
+drop:
+	kfree_skb(skb);
+
+	return ret;
+}
+EXPORT_SYMBOL(lwtunnel_xmit);
+
 int lwtunnel_input(struct sk_buff *skb)
 {
 	struct dst_entry *dst = skb_dst(skb);
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index dde37fb..6556927 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -73,6 +73,7 @@
 #include <net/icmp.h>
 #include <net/checksum.h>
 #include <net/inetpeer.h>
+#include <net/lwtunnel.h>
 #include <linux/igmp.h>
 #include <linux/netfilter_ipv4.h>
 #include <linux/netfilter_bridge.h>
@@ -197,6 +198,13 @@ static int ip_finish_output2(struct net *net, struct sock *sk, struct sk_buff *s
 		skb = skb2;
 	}
 
+	if (lwtunnel_xmit_redirect(dst->lwtstate)) {
+		int res = lwtunnel_xmit(skb);
+
+		if (res < 0 || res == LWTUNNEL_XMIT_DONE)
+			return res;
+	}
+
 	rcu_read_lock_bh();
 	nexthop = (__force u32) rt_nexthop(rt, ip_hdr(skb)->daddr);
 	neigh = __ipv4_neigh_lookup_noref(dev, nexthop);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index a1f2830..3e99278 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1246,7 +1246,9 @@ static unsigned int ipv4_mtu(const struct dst_entry *dst)
 			mtu = 576;
 	}
 
-	return min_t(unsigned int, mtu, IP_MAX_MTU);
+	mtu = min_t(unsigned int, mtu, IP_MAX_MTU);
+
+	return mtu - lwtunnel_headroom(dst->lwtstate, mtu);
 }
 
 static struct fib_nh_exception *find_exception(struct fib_nh *nh, __be32 daddr)
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 1dfc402..993fd96 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -56,6 +56,7 @@
 #include <net/checksum.h>
 #include <linux/mroute6.h>
 #include <net/l3mdev.h>
+#include <net/lwtunnel.h>
 
 static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff *skb)
 {
@@ -104,6 +105,13 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff *
 		}
 	}
 
+	if (lwtunnel_xmit_redirect(dst->lwtstate)) {
+		int res = lwtunnel_xmit(skb);
+
+		if (res < 0 || res == LWTUNNEL_XMIT_DONE)
+			return res;
+	}
+
 	rcu_read_lock_bh();
 	nexthop = rt6_nexthop((struct rt6_info *)dst, &ipv6_hdr(skb)->daddr);
 	neigh = __ipv6_neigh_lookup_noref(dst->dev, nexthop);
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 4981755..09d43ff 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1604,7 +1604,9 @@ static unsigned int ip6_mtu(const struct dst_entry *dst)
 	rcu_read_unlock();
 
 out:
-	return min_t(unsigned int, mtu, IP6_MAX_MTU);
+	mtu = min_t(unsigned int, mtu, IP6_MAX_MTU);
+
+	return mtu - lwtunnel_headroom(dst->lwtstate, mtu);
 }
 
 static struct dst_entry *icmp6_dst_gc_list;
diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c
index 644a8da..aed872c 100644
--- a/net/mpls/mpls_iptunnel.c
+++ b/net/mpls/mpls_iptunnel.c
@@ -37,7 +37,7 @@ static unsigned int mpls_encap_size(struct mpls_iptunnel_encap *en)
 	return en->labels * sizeof(struct mpls_shim_hdr);
 }
 
-static int mpls_output(struct net *net, struct sock *sk, struct sk_buff *skb)
+static int mpls_xmit(struct sk_buff *skb)
 {
 	struct mpls_iptunnel_encap *tun_encap_info;
 	struct mpls_shim_hdr *hdr;
@@ -115,7 +115,7 @@ static int mpls_output(struct net *net, struct sock *sk, struct sk_buff *skb)
 		net_dbg_ratelimited("%s: packet transmission failed: %d\n",
 				    __func__, err);
 
-	return 0;
+	return LWTUNNEL_XMIT_DONE;
 
 drop:
 	kfree_skb(skb);
@@ -153,7 +153,8 @@ static int mpls_build_state(struct net_device *dev, struct nlattr *nla,
 	if (ret)
 		goto errout;
 	newts->type = LWTUNNEL_ENCAP_MPLS;
-	newts->flags |= LWTUNNEL_STATE_OUTPUT_REDIRECT;
+	newts->flags |= LWTUNNEL_STATE_XMIT_REDIRECT;
+	newts->headroom = mpls_encap_size(tun_encap_info);
 
 	*ts = newts;
 
@@ -209,7 +210,7 @@ static int mpls_encap_cmp(struct lwtunnel_state *a, struct lwtunnel_state *b)
 
 static const struct lwtunnel_encap_ops mpls_iptun_ops = {
 	.build_state = mpls_build_state,
-	.output = mpls_output,
+	.xmit = mpls_xmit,
 	.fill_encap = mpls_fill_encap_info,
 	.get_encap_size = mpls_encap_nlsize,
 	.cmp_encap = mpls_encap_cmp,
-- 
1.9.1

[PATCH net-next 2/3] net: mpls fixes for GSO

From: Roopa Prabhu <hidden>
Date: 2016-08-11 06:50:50

From: David Ahern <redacted>

Signed-off-by: David Ahern <redacted>
Reported-by: Lennert Buytenhek <redacted>
---
 net/mpls/mpls_gso.c      | 24 ++++++++++++++++--------
 net/mpls/mpls_iptunnel.c |  7 +++++++
 2 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/net/mpls/mpls_gso.c b/net/mpls/mpls_gso.c
index 2055e57..8829ee0 100644
--- a/net/mpls/mpls_gso.c
+++ b/net/mpls/mpls_gso.c
@@ -22,26 +22,28 @@
 static struct sk_buff *mpls_gso_segment(struct sk_buff *skb,
 				       netdev_features_t features)
 {
+	int tnl_hlen = skb_inner_mac_header(skb) - skb_transport_header(skb);
 	struct sk_buff *segs = ERR_PTR(-EINVAL);
+	u16 mac_offset = skb->mac_header;
 	netdev_features_t mpls_features;
 	__be16 mpls_protocol;
+	u16 mac_len = skb->mac_len;
 
 	/* Setup inner SKB. */
 	mpls_protocol = skb->protocol;
 	skb->protocol = skb->inner_protocol;
 
-	/* Push back the mac header that skb_mac_gso_segment() has pulled.
-	 * It will be re-pulled by the call to skb_mac_gso_segment() below
-	 */
-	__skb_push(skb, skb->mac_len);
+	__skb_pull(skb, tnl_hlen);
+	skb->mac_len = skb_inner_network_offset(skb);
 
 	/* Segment inner packet. */
 	mpls_features = skb->dev->mpls_features & features;
 	segs = skb_mac_gso_segment(skb, mpls_features);
-
-
-	/* Restore outer protocol. */
-	skb->protocol = mpls_protocol;
+	if (IS_ERR_OR_NULL(segs)) {
+		skb_gso_error_unwind(skb, mpls_protocol, tnl_hlen, mac_offset,
+				     mac_len);
+		goto out;
+	}
 
 	/* Re-pull the mac header that the call to skb_mac_gso_segment()
 	 * above pulled.  It will be re-pushed after returning
@@ -49,6 +51,12 @@ static struct sk_buff *mpls_gso_segment(struct sk_buff *skb,
 	 */
 	__skb_pull(skb, skb->data - skb_mac_header(skb));
 
+	/* Restore outer protocol. */
+	skb->protocol = mpls_protocol;
+	for (skb = segs; skb; skb = skb->next)
+		skb->protocol = mpls_protocol;
+
+out:
 	return segs;
 }
 
diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c
index aed872c..87e035a 100644
--- a/net/mpls/mpls_iptunnel.c
+++ b/net/mpls/mpls_iptunnel.c
@@ -90,8 +90,15 @@ static int mpls_xmit(struct sk_buff *skb)
 	if (skb_cow(skb, hh_len + new_header_size))
 		goto drop;
 
+	skb_reset_mac_header(skb);
+	skb_reset_inner_headers(skb);
+	skb->encapsulation = 1;
+
 	skb_push(skb, new_header_size);
+
 	skb_reset_network_header(skb);
+	skb_reset_transport_header(skb);
+	skb_set_inner_protocol(skb, skb->protocol);
 
 	skb->dev = out_dev;
 	skb->protocol = htons(ETH_P_MPLS_UC);
-- 
1.9.1

[PATCH net-next 3/3] net: veth: set features for MPLS

From: Roopa Prabhu <hidden>
Date: 2016-08-11 06:51:39

From: David Ahern <redacted>

With hw checksum and gso set, netperf through veth for mpls is
on par without mpls.

Signed-off-by: David Ahern <redacted>
Reported-by: Lennert Buytenhek <redacted>
---
 drivers/net/veth.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index f37a6e6..5db320a 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -340,6 +340,7 @@ static void veth_setup(struct net_device *dev)
 
 	dev->hw_features = VETH_FEATURES;
 	dev->hw_enc_features = VETH_FEATURES;
+	dev->mpls_features = NETIF_F_HW_CSUM | NETIF_F_GSO_SOFTWARE;
 }
 
 /*
-- 
1.9.1

Re: [PATCH net-next 1/3] lwtunnel: xmit redirect

From: kbuild test robot <hidden>
Date: 2016-08-11 07:06:34

Hi Roopa,

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Roopa-Prabhu/lwtunnel-xmit-redirect/20160811-145357
config: i386-randconfig-x002-201632 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   net/ipv4/ip_output.c: In function 'ip_finish_output2':
quoted
net/ipv4/ip_output.c:202:13: error: too few arguments to function 'lwtunnel_xmit'
      int res = lwtunnel_xmit(skb);
                ^~~~~~~~~~~~~
   In file included from net/ipv4/ip_output.c:76:0:
   include/net/lwtunnel.h:212:19: note: declared here
    static inline int lwtunnel_xmit(struct sk_buff *skb, u32 *status)
                      ^~~~~~~~~~~~~

vim +/lwtunnel_xmit +202 net/ipv4/ip_output.c

   196				skb_set_owner_w(skb2, skb->sk);
   197			consume_skb(skb);
   198			skb = skb2;
   199		}
   200	
   201		if (lwtunnel_xmit_redirect(dst->lwtstate)) {
 > 202			int res = lwtunnel_xmit(skb);
   203	
   204			if (res < 0 || res == LWTUNNEL_XMIT_DONE)
   205				return res;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Re: [PATCH net-next 1/3] lwtunnel: xmit redirect

From: kbuild test robot <hidden>
Date: 2016-08-11 07:08:45

Hi Roopa,

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Roopa-Prabhu/lwtunnel-xmit-redirect/20160811-145357
config: x86_64-randconfig-x016-201632 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   net/ipv6/ip6_output.c: In function 'ip6_finish_output2':
quoted
net/ipv6/ip6_output.c:109:13: error: too few arguments to function 'lwtunnel_xmit'
      int res = lwtunnel_xmit(skb);
                ^~~~~~~~~~~~~
   In file included from net/ipv6/ip6_output.c:59:0:
   include/net/lwtunnel.h:212:19: note: declared here
    static inline int lwtunnel_xmit(struct sk_buff *skb, u32 *status)
                      ^~~~~~~~~~~~~

vim +/lwtunnel_xmit +109 net/ipv6/ip6_output.c

   103				kfree_skb(skb);
   104				return 0;
   105			}
   106		}
   107	
   108		if (lwtunnel_xmit_redirect(dst->lwtstate)) {
 > 109			int res = lwtunnel_xmit(skb);
   110	
   111			if (res < 0 || res == LWTUNNEL_XMIT_DONE)
   112				return res;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Re: [PATCH net-next 2/3] net: mpls fixes for GSO

From: Simon Horman <hidden>
Date: 2016-08-11 07:47:41

On Wed, Aug 10, 2016 at 11:43:31PM -0700, Roopa Prabhu wrote:
From: David Ahern <redacted>

Signed-off-by: David Ahern <redacted>
Reported-by: Lennert Buytenhek <redacted>
Thanks. This looks like it should be correct to me.  However, I would
appreciate it if you could give me a little time to test it against OvS.

I think the changelog could also do with a few more words given the
complexity (at least to me) of getting this right for all consumers.
quoted hunk
---
 net/mpls/mpls_gso.c      | 24 ++++++++++++++++--------
 net/mpls/mpls_iptunnel.c |  7 +++++++
 2 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/net/mpls/mpls_gso.c b/net/mpls/mpls_gso.c
index 2055e57..8829ee0 100644
--- a/net/mpls/mpls_gso.c
+++ b/net/mpls/mpls_gso.c
@@ -22,26 +22,28 @@
 static struct sk_buff *mpls_gso_segment(struct sk_buff *skb,
 				       netdev_features_t features)
 {
+	int tnl_hlen = skb_inner_mac_header(skb) - skb_transport_header(skb);
 	struct sk_buff *segs = ERR_PTR(-EINVAL);
+	u16 mac_offset = skb->mac_header;
 	netdev_features_t mpls_features;
 	__be16 mpls_protocol;
+	u16 mac_len = skb->mac_len;
 
 	/* Setup inner SKB. */
 	mpls_protocol = skb->protocol;
 	skb->protocol = skb->inner_protocol;
 
-	/* Push back the mac header that skb_mac_gso_segment() has pulled.
-	 * It will be re-pulled by the call to skb_mac_gso_segment() below
-	 */
-	__skb_push(skb, skb->mac_len);
+	__skb_pull(skb, tnl_hlen);
+	skb->mac_len = skb_inner_network_offset(skb);
 
 	/* Segment inner packet. */
 	mpls_features = skb->dev->mpls_features & features;
 	segs = skb_mac_gso_segment(skb, mpls_features);
-
-
-	/* Restore outer protocol. */
-	skb->protocol = mpls_protocol;
+	if (IS_ERR_OR_NULL(segs)) {
+		skb_gso_error_unwind(skb, mpls_protocol, tnl_hlen, mac_offset,
+				     mac_len);
+		goto out;
+	}
 
 	/* Re-pull the mac header that the call to skb_mac_gso_segment()
 	 * above pulled.  It will be re-pushed after returning
@@ -49,6 +51,12 @@ static struct sk_buff *mpls_gso_segment(struct sk_buff *skb,
 	 */
 	__skb_pull(skb, skb->data - skb_mac_header(skb));
 
+	/* Restore outer protocol. */
+	skb->protocol = mpls_protocol;
+	for (skb = segs; skb; skb = skb->next)
+		skb->protocol = mpls_protocol;
+
+out:
 	return segs;
 }
 
diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c
index aed872c..87e035a 100644
--- a/net/mpls/mpls_iptunnel.c
+++ b/net/mpls/mpls_iptunnel.c
@@ -90,8 +90,15 @@ static int mpls_xmit(struct sk_buff *skb)
 	if (skb_cow(skb, hh_len + new_header_size))
 		goto drop;
 
+	skb_reset_mac_header(skb);
+	skb_reset_inner_headers(skb);
+	skb->encapsulation = 1;
+
 	skb_push(skb, new_header_size);
+
 	skb_reset_network_header(skb);
+	skb_reset_transport_header(skb);
+	skb_set_inner_protocol(skb, skb->protocol);
 
 	skb->dev = out_dev;
 	skb->protocol = htons(ETH_P_MPLS_UC);
-- 
1.9.1

Re: [PATCH net-next 2/3] net: mpls fixes for GSO

From: Simon Horman <hidden>
Date: 2016-08-11 13:30:48

Hi Roopa,

On Thu, Aug 11, 2016 at 09:47:36AM +0200, Simon Horman wrote:
On Wed, Aug 10, 2016 at 11:43:31PM -0700, Roopa Prabhu wrote:
quoted
From: David Ahern <redacted>

Signed-off-by: David Ahern <redacted>
Reported-by: Lennert Buytenhek <redacted>
Thanks. This looks like it should be correct to me.  However, I would
appreciate it if you could give me a little time to test it against OvS.
Unfortunately I was a little bit optimistic.

I tested this patch on top of net-next.
My setup is OVS receiving TCP/IP from an ethernet interface,
adding an MPLS LSE; and outputting to a GRE vport (netdev).

This occurs:

[   11.629192] ------------[ cut here ]------------
[   11.629362] kernel BUG at net/core/skbuff.c:105!
[   11.629362] invalid opcode: 0000 [#1] SMP
[   11.629362] Modules linked in: vport_gre openvswitch
[   11.629362] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.7.0-11619-g218d62929694 #873
[   11.629362] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
[   11.629362] task: ffffffff8160c500 task.stack: ffffffff81600000
[   11.629362] RIP: 0010:[<ffffffff8127afd2>]  [<ffffffff8127afd2>] skb_panic+0x62/0x70
[   11.629362] RSP: 0018:ffff88001b4038c8  EFLAGS: 00010292
[   11.629362] RAX: 000000000000008a RBX: ffff88001b2e7400 RCX: 0000000000000000
[   11.629362] RDX: 000000000000008a RSI: ffff88001b40c748 RDI: ffff88001b40c748
[   11.629362] RBP: 0000000000004788 R08: 000000000000011a R09: 0000000000ffff0a
[   11.629362] R10: 0000000000000004 R11: 000000000000011a R12: 000000000000003c
[   11.629362] R13: 0000000000000012 R14: ffffffffffffff9e R15: ffffffffffffffea
[   11.629362] FS:  0000000000000000(0000) GS:ffff88001b400000(0000) knlGS:0000000000000000
[   11.629362] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   11.629362] CR2: 00007f998faa08a0 CR3: 000000001fa79000 CR4: 00000000000006b0
[   11.629362] Stack:
[   11.629362]  ffff87ff16bb609e 00000000000000c0 00000000000000c0 ffff880016b96800
[   11.629362]  ffffffff8127b01c ffffffff8139c34f ffff88001b2e7400 0000000000000001
[   11.629362]  0000000000000001 ffff880016b96800 ffff880016b6689c ffff880016b66800
[   11.629362] Call Trace:
[   11.629362]  <IRQ> 
[   11.629362]  [<ffffffff8127b01c>] ? skb_push+0x3c/0x40
[   11.629362]  [<ffffffff8139c34f>] ? mpls_gso_segment+0x12f/0x170
[   11.629362]  [<ffffffff8128e54f>] ? skb_mac_gso_segment+0x9f/0x100
[   11.629362]  [<ffffffff8128ea94>] ? validate_xmit_skb+0x144/0x2a0
[   11.629362]  [<ffffffff8128ee2e>] ? validate_xmit_skb_list+0x3e/0x60
[   11.629362]  [<ffffffff812ae466>] ? sch_direct_xmit+0xf6/0x190
[   11.629362]  [<ffffffff8128f142>] ? __dev_queue_xmit+0x222/0x640
[   11.629362]  [<ffffffffa000089d>] ? do_output.isra.30+0x1d/0x200 [openvswitch]
[   11.629362]  [<ffffffffa00011ab>] ? do_execute_actions+0x72b/0x12d0 [openvswitch]
[   11.629362]  [<ffffffffa0001d90>] ? ovs_execute_actions+0x40/0x120 [openvswitch]
[   11.629362]  [<ffffffffa0004e2d>] ? ovs_dp_process_packet+0x6d/0x110 [openvswitch]
[   11.629362]  [<ffffffffa0004e2d>] ? ovs_dp_process_packet+0x6d/0x110 [openvswitch]
[   11.629362]  [<ffffffffa0005c19>] ? key_extract+0x919/0xb90 [openvswitch]
[   11.629362]  [<ffffffffa000c602>] ? ovs_vport_receive+0x42/0x70 [openvswitch]
[   11.629362]  [<ffffffffa0001e0e>] ? ovs_execute_actions+0xbe/0x120 [openvswitch]
[   11.629362]  [<ffffffffa0004e2d>] ? ovs_dp_process_packet+0x6d/0x110 [openvswitch]
[   11.629362]  [<ffffffffa00054d5>] ? key_extract+0x1d5/0xb90 [openvswitch]
[   11.629362]  [<ffffffffa000c602>] ? ovs_vport_receive+0x42/0x70 [openvswitch]
[   11.629362]  [<ffffffff8132dc3c>] ? ip_tunnel_rcv+0x1bc/0x430
[   11.629362]  [<ffffffff81331265>] ? __ipgre_rcv+0x185/0x1d0
[   11.629362]  [<ffffffff81331313>] ? gre_rcv+0x63/0xf0
[   11.629362]  [<ffffffff812ebd80>] ? inet_del_offload+0x40/0x40
[   11.629362]  [<ffffffffa000d439>] ? netdev_frame_hook+0xf9/0x150 [openvswitch]
[   11.629362]  [<ffffffff8128a23c>] ? __netif_receive_skb_core+0x34c/0x950
[   11.629362]  [<ffffffff81280335>] ? __build_skb+0x25/0xd0
[   11.629362]  [<ffffffff812805eb>] ? __napi_alloc_skb+0x9b/0xd0
[   11.629362]  [<ffffffff8128c479>] ? netif_receive_skb_internal+0x29/0x90
[   11.629362]  [<ffffffff8128cf97>] ? napi_gro_receive+0x87/0x120
[   11.629362]  [<ffffffff8122fe64>] ? virtnet_receive+0x194/0x7d0
[   11.629362]  [<ffffffff81230588>] ? virtnet_poll+0x18/0x70
[   11.629362]  [<ffffffff8128d970>] ? net_rx_action+0x1a0/0x2e0
[   11.629362]  [<ffffffff813a8f2c>] ? __do_softirq+0x9c/0x2af
[   11.629362]  [<ffffffff81046922>] ? irq_exit+0x42/0x50
[   11.629362]  [<ffffffff813a8ccf>] ? do_IRQ+0x4f/0xd0
[   11.629362]  [<ffffffff813a76bf>] ? common_interrupt+0x7f/0x7f
[   11.629362]  <EOI> 
[   11.629362]  [<ffffffff81021f6a>] ? default_idle+0x1a/0xd0
[   11.629362]  [<ffffffff810758a0>] ? cpu_startup_entry+0x1b0/0x310
[   11.629362]  [<ffffffff8169add1>] ? start_kernel+0x3b6/0x3be
[   11.629362] Code: 00 00 48 89 44 24 10 8b 87 c8 00 00 00 48 89 44 24 08 48 8b 87 d8 00 00 00 48 c7 c7 e8 b9 54 81 48 89 04 24 31 c0 e8 5b 84 e5 ff <0f> 0b 66 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 8b 
[   11.629362] RIP  [<ffffffff8127afd2>] skb_panic+0x62/0x70
[   11.629362]  RSP <ffff88001b4038c8>
[   11.711455] ---[ end trace c17de15e7cb43181 ]---
[   11.711953] Kernel panic - not syncing: Fatal exc

Re: [PATCH net-next 2/3] net: mpls fixes for GSO

From: David Ahern <hidden>
Date: 2016-08-11 13:47:15

Hi Simon:

On 8/11/16 7:30 AM, Simon Horman wrote:
On Thu, Aug 11, 2016 at 09:47:36AM +0200, Simon Horman wrote:
quoted
quoted
On Wed, Aug 10, 2016 at 11:43:31PM -0700, Roopa Prabhu wrote:
quoted
quoted
From: David Ahern <redacted>

Signed-off-by: David Ahern <redacted>
Reported-by: Lennert Buytenhek <redacted>
Thanks. This looks like it should be correct to me.  However, I would
appreciate it if you could give me a little time to test it against OvS.
Unfortunately I was a little bit optimistic.

I tested this patch on top of net-next.
My setup is OVS receiving TCP/IP from an ethernet interface,
adding an MPLS LSE; and outputting to a GRE vport (netdev).
Miscommunication between Roopa and myself. I was not ready for the patches to hit netdev yet. As you found more testing is needed.

Since you hit a panic can you share the commands used to configure the node?

David

Re: [PATCH net-next 0/3] lwtunnel, mpls fragmentation and gso fixes

From: Roopa Prabhu <hidden>
Date: 2016-08-11 13:49:56

On 8/10/16, 11:43 PM, Roopa Prabhu wrote:
From: Roopa Prabhu <redacted>

This series fixes a few issues around mtu and fragmentation
for tunnels using lwtunnel output redirect and also fixes
a few gso issues recently reported by Lennert Buytenhek.

David Ahern (2):
  net: mpls fixes for GSO
  net: veth: set features for MPLS

Roopa Prabhu (1):
  lwtunnel: xmit redirect
I see kbuild test robot reporting some compile errors.
I must have screwed up the submission last night and
in a hurry to get some more review i did not test it with other configs. sorry about that.
will fix these + any other pending review comments and send out a v2 later today.

thanks,
Roopa
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help