Message ID | 1467274002-61390-3-git-send-email-pshelar@ovn.org |
---|---|
State | Superseded |
Headers | show |
On Thu, Jun 30, 2016 at 1:06 AM, Pravin B Shelar <pshelar@ovn.org> wrote: > 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> Since this patch bumps up the version that we'll use our backports for, we'll need to remember that this effectively has a dependency on later patches in the series. Otherwise, we'll have a situation like with 2.4 where using the backport causes a regression in some cases.
diff --git a/acinclude.m4 b/acinclude.m4 index 65d41f0..263c31d 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -432,7 +432,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ OVS_GREP_IFELSE([$KSRC/include/net/inetpeer.h], [vif], [OVS_DEFINE([HAVE_INETPEER_VIF_SUPPORT])]) - OVS_GREP_IFELSE([$KSRC/include/net/dst_metadata.h], [metadata_dst]) + OVS_GREP_IFELSE([$KSRC/include/net/ip_tunnels.h], [iptunnel_pull_offloads], + [OVS_DEFINE([HAVE_METADATA_DST])]) OVS_GREP_IFELSE([$KSRC/include/linux/net.h], [sock_create_kern.*net], [OVS_DEFINE([HAVE_SOCK_CREATE_KERN_NET])]) diff --git a/datapath/linux/compat/include/net/ip_tunnels.h b/datapath/linux/compat/include/net/ip_tunnels.h index bf67ac4..26c9041 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 c5fb2b7..ee4fadc 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);