summaryrefslogtreecommitdiff
path: root/datapath
diff options
context:
space:
mode:
authorPravin B Shelar <pshelar@ovn.org>2016-07-07 21:46:11 -0700
committerPravin B Shelar <pshelar@ovn.org>2016-07-08 19:27:48 -0700
commit5a109898bdda855cd8e1d846d2e0981db176f3b4 (patch)
treef2b9d6390fbe04690253347228d6388b3c220a06 /datapath
parentc6e13fccb90bb502410fd58611e82749d34078b5 (diff)
downloadopenvswitch-5a109898bdda855cd8e1d846d2e0981db176f3b4.tar.gz
datapath: backport: tunnels: Remove encapsulation offloads on decap.
Following patch backports updated iptunnel pull function. Also brings in following upstream fix: commit a09a4c8dd1ec7f830e1fb9e59eb72bddc965d168 Author: Jesse Gross <jesse@kernel.org> tunnels: Remove encapsulation offloads on decap. If a packet is either locally encapsulated or processed through GRO it is marked with the offloads that it requires. However, when it is decapsulated these tunnel offload indications are not removed. This means that if we receive an encapsulated TCP packet, aggregate it with GRO, decapsulate, and retransmit the resulting frame on a NIC that does not support encapsulation, we won't be able to take advantage of hardware offloads even though it is just a simple TCP packet at this point. This fixes the problem by stripping off encapsulation offload indications when packets are decapsulated. The performance impacts of this bug are significant. In a test where a Geneve encapsulated TCP stream is sent to a hypervisor, GRO'ed, decapsulated, and bridged to a VM performance is improved by 60% (5Gbps->8Gbps) as a result of avoiding unnecessary segmentation at the VM tap interface. Reported-by: Ramu Ramamurthy <sramamur@linux.vnet.ibm.com> Fixes: 68c33163 ("v4 GRE: Add TCP segmentation offload for GRE") Signed-off-by: Jesse Gross <jesse@kernel.org> 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>
Diffstat (limited to 'datapath')
-rw-r--r--datapath/linux/compat/include/net/ip_tunnels.h15
-rw-r--r--datapath/linux/compat/ip_tunnels_core.c2
2 files changed, 16 insertions, 1 deletions
diff --git a/datapath/linux/compat/include/net/ip_tunnels.h b/datapath/linux/compat/include/net/ip_tunnels.h
index bf67ac4f1..26c9041f0 100644
--- a/datapath/linux/compat/include/net/ip_tunnels.h
+++ b/datapath/linux/compat/include/net/ip_tunnels.h
@@ -339,4 +339,19 @@ struct net *rpl_ip_tunnel_get_link_net(const struct net_device *dev);
int rpl___ip_tunnel_change_mtu(struct net_device *dev, int new_mtu, bool strict);
#endif
+static inline int iptunnel_pull_offloads(struct sk_buff *skb)
+{
+ if (skb_is_gso(skb)) {
+ int err;
+
+ err = skb_unclone(skb, GFP_ATOMIC);
+ if (unlikely(err))
+ return err;
+ skb_shinfo(skb)->gso_type &= ~(NETIF_F_GSO_ENCAP_ALL >>
+ NETIF_F_GSO_SHIFT);
+ }
+
+ skb->encapsulation = 0;
+ return 0;
+}
#endif /* __NET_IP_TUNNELS_H */
diff --git a/datapath/linux/compat/ip_tunnels_core.c b/datapath/linux/compat/ip_tunnels_core.c
index c5fb2b76a..ee4fadcb5 100644
--- a/datapath/linux/compat/ip_tunnels_core.c
+++ b/datapath/linux/compat/ip_tunnels_core.c
@@ -171,7 +171,7 @@ int rpl___iptunnel_pull_header(struct sk_buff *skb, int hdr_len,
skb_set_queue_mapping(skb, 0);
skb_scrub_packet(skb, xnet);
- return 0;
+ return iptunnel_pull_offloads(skb);
}
EXPORT_SYMBOL_GPL(rpl___iptunnel_pull_header);