datapath: Add support for RHEL-7 / CentOS-7 kernel.
[cascardo/ovs.git] / datapath / linux / compat / include / net / ip_tunnels.h
index 5d0267d..9afab8c 100644 (file)
@@ -2,7 +2,15 @@
 #define __NET_IP_TUNNELS_WRAPPER_H 1
 
 #include <linux/version.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)
+#if defined(HAVE_GRE_HANDLE_OFFLOADS) && \
+     LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+/* RHEL6 and RHEL7 both has backported tunnel API but RHEL6 has
+ * older version, so avoid using RHEL6 backports.
+ */
+#define GRE_USE_KERNEL_GRE_HANDLE_OFFLOADS
+#endif
+
+#ifdef GRE_USE_KERNEL_GRE_HANDLE_OFFLOADS
 #include_next <net/ip_tunnels.h>
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)
@@ -11,7 +19,11 @@ static inline int rpl_iptunnel_xmit(struct sock *sk, struct rtable *rt,
                                    __be32 dst, __u8 proto, __u8 tos,
                                    __u8 ttl, __be16 df, bool xnet)
 {
+#ifdef HAVE_IPTUNNEL_XMIT_NET
+       return iptunnel_xmit(NULL, rt, skb, src, dst, proto, tos, ttl, df);
+#else
        return iptunnel_xmit(rt, skb, src, dst, proto, tos, ttl, df, xnet);
+#endif
 }
 #define iptunnel_xmit rpl_iptunnel_xmit
 #endif