diff mbox

[ovs-dev,v3,22/28] datapath: backport: udp_offload: Set encapsulation before inner completes.

Message ID 1467421259-121789-3-git-send-email-pshelar@ovn.org
State Superseded
Headers show

Commit Message

Pravin Shelar July 2, 2016, 1 a.m. UTC
Upstream commit:
    commit 229740c63169462a838a8b8e16391ed000934631
    Author: Jarno Rajahalme <jarno@ovn.org>

    udp_offload: Set encapsulation before inner completes.

    UDP tunnel segmentation code relies on the inner offsets being set for
    an UDP tunnel GSO packet, but the inner *_complete() functions will
    set the inner offsets only if 'encapsulation' is set before calling
    them.  Currently, udp_gro_complete() sets 'encapsulation' only after
    the inner *_complete() functions are done.  This causes the inner
    offsets having invalid values after udp_gro_complete() returns, which
    in turn will make it impossible to properly segment the packet in case
    it needs to be forwarded, which would be visible to the user either as
    invalid packets being sent or as packet loss.

    This patch fixes this by setting skb's 'encapsulation' in
    udp_gro_complete() before calling into the inner complete functions,
    and by making each possible UDP tunnel gro_complete() callback set the
    inner_mac_header to the beginning of the tunnel payload.

    Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
    Reviewed-by: Alexander Duyck <aduyck@mirantis.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
---
 datapath/linux/compat/geneve.c | 2 ++
 datapath/linux/compat/vxlan.c  | 3 +++
 2 files changed, 5 insertions(+)
diff mbox

Patch

diff --git a/datapath/linux/compat/geneve.c b/datapath/linux/compat/geneve.c
index 4dee940..6e1b759 100644
--- a/datapath/linux/compat/geneve.c
+++ b/datapath/linux/compat/geneve.c
@@ -566,6 +566,8 @@  static int geneve_gro_complete(struct sk_buff *skb, int nhoff,
 		err = ptype->callbacks.gro_complete(skb, nhoff + gh_len);
 
 	rcu_read_unlock();
+
+	skb_set_inner_mac_header(skb, nhoff + gh_len);
 	return err;
 }
 #endif
diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c
index 358c373..ca33358 100644
--- a/datapath/linux/compat/vxlan.c
+++ b/datapath/linux/compat/vxlan.c
@@ -361,6 +361,9 @@  static int vxlan_gro_complete(struct sk_buff *skb, int nhoff,
                               struct udp_offload *uoff)
 #endif
 {
+	/* Sets 'skb->inner_mac_header' since we are always called with
+	 * 'skb->encapsulation' set.
+	 */
 	udp_tunnel_gro_complete(skb, nhoff);
 
 	return eth_gro_complete(skb, nhoff + sizeof(struct vxlanhdr));