[ovs-dev] [PATCH 1/6] datapath: compat: Detect GSO support at ovs configure

Pravin B Shelar pshelar at ovn.org
Tue Aug 2 21:17:58 UTC 2016


OVS turns on tunnel GSO backport statically for kernel older than
3.18. Some distributions kernels could backport tunnel GSO. To make
use of device tunnel offload on such kernel detect the support at
configure stage.

Signed-off-by: Pravin B Shelar <pshelar at ovn.org>
---
 acinclude.m4                                   | 2 ++
 datapath/linux/compat/gso.c                    | 4 ++--
 datapath/linux/compat/gso.h                    | 9 +++++----
 datapath/linux/compat/include/net/udp_tunnel.h | 2 +-
 datapath/linux/compat/ip_tunnels_core.c        | 2 +-
 5 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 49f0781..f02166d 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -462,6 +462,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
   OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [__skb_gso_segment])
   OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [can_checksum_protocol])
   OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [ndo_get_iflink])
+  OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [ndo_features_check],
+                  [OVS_DEFINE([USE_UPSTREAM_TUNNEL_GSO])])
   OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [ndo_add_vxlan_port])
   OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [ndo_add_geneve_port])
   OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [netdev_features_t])
diff --git a/datapath/linux/compat/gso.c b/datapath/linux/compat/gso.c
index fbbbc89..1f24e74 100644
--- a/datapath/linux/compat/gso.c
+++ b/datapath/linux/compat/gso.c
@@ -132,7 +132,7 @@ drop:
 EXPORT_SYMBOL_GPL(rpl_dev_queue_xmit);
 #endif /* OVS_USE_COMPAT_GSO_SEGMENTATION */
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
+#ifndef USE_UPSTREAM_TUNNEL_GSO
 static __be16 __skb_network_protocol(struct sk_buff *skb)
 {
 	__be16 type = skb->protocol;
@@ -310,4 +310,4 @@ int rpl_ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)
 	return output_ipv6(skb);
 }
 EXPORT_SYMBOL_GPL(rpl_ip6_local_out);
-#endif /* 3.18 */
+#endif /* USE_UPSTREAM_TUNNEL_GSO */
diff --git a/datapath/linux/compat/gso.h b/datapath/linux/compat/gso.h
index d088206..23edacd 100644
--- a/datapath/linux/compat/gso.h
+++ b/datapath/linux/compat/gso.h
@@ -11,7 +11,7 @@ struct ovs_gso_cb {
 #ifndef USE_UPSTREAM_TUNNEL
 	struct metadata_dst	*tun_dst;
 #endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
+#ifndef USE_UPSTREAM_TUNNEL_GSO
 	gso_fix_segment_t fix_segment;
 #endif
 #ifndef HAVE_INNER_PROTOCOL
@@ -26,7 +26,7 @@ struct ovs_gso_cb {
 #define OVS_GSO_CB(skb) ((struct ovs_gso_cb *)(skb)->cb)
 
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
+#ifndef USE_UPSTREAM_TUNNEL_GSO
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
 #include <net/protocol.h>
@@ -85,12 +85,13 @@ static inline void ovs_skb_set_inner_protocol(struct sk_buff *skb,
 #endif /* ENCAP_TYPE_ETHER */
 #endif /* HAVE_INNER_PROTOCOL */
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
+#define skb_inner_mac_offset rpl_skb_inner_mac_offset
 static inline int skb_inner_mac_offset(const struct sk_buff *skb)
 {
 	return skb_inner_mac_header(skb) - skb->data;
 }
 
+#ifndef USE_UPSTREAM_TUNNEL_GSO
 #define ip_local_out rpl_ip_local_out
 int rpl_ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb);
 
@@ -121,7 +122,7 @@ static inline int rpl_ip6_local_out(struct net *net, struct sock *sk, struct sk_
 }
 #define ip6_local_out rpl_ip6_local_out
 
-#endif /* 3.18 */
+#endif /* USE_UPSTREAM_TUNNEL_GSO */
 
 #ifndef USE_UPSTREAM_TUNNEL
 /* We need two separate functions to manage different dst in this case.
diff --git a/datapath/linux/compat/include/net/udp_tunnel.h b/datapath/linux/compat/include/net/udp_tunnel.h
index 8afacb8..e6b7d84 100644
--- a/datapath/linux/compat/include/net/udp_tunnel.h
+++ b/datapath/linux/compat/include/net/udp_tunnel.h
@@ -163,7 +163,7 @@ static inline int rpl_udp_tunnel_handle_offloads(struct sk_buff *skb,
 		fix_segment = ovs_udp_gso;
 	else
 		fix_segment = ovs_udp_csum_gso;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
+#ifndef USE_UPSTREAM_TUNNEL_GSO
 	/* This functuin is not used by vxlan lan tunnel. On older
 	 * udp offload only supports vxlan, therefore fallback to software
 	 * segmentation.
diff --git a/datapath/linux/compat/ip_tunnels_core.c b/datapath/linux/compat/ip_tunnels_core.c
index 8eab276..6e84e80 100644
--- a/datapath/linux/compat/ip_tunnels_core.c
+++ b/datapath/linux/compat/ip_tunnels_core.c
@@ -111,7 +111,7 @@ int ovs_iptunnel_handle_offloads(struct sk_buff *skb,
 			goto error;
 		skb_shinfo(skb)->gso_type |= gso_type_mask;
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
+#ifndef USE_UPSTREAM_TUNNEL_GSO
 		if (gso_type_mask)
 			fix_segment = NULL;
 
-- 
1.9.1




More information about the dev mailing list