datapath: Add support for RHEL-7 / CentOS-7 kernel.
[cascardo/ovs.git] / datapath / linux / compat / include / net / ip_tunnels.h
index c7a14ef..9afab8c 100644 (file)
@@ -2,8 +2,32 @@
 #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)
+static inline int rpl_iptunnel_xmit(struct sock *sk, struct rtable *rt,
+                                   struct sk_buff *skb, __be32 src,
+                                   __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
+
 #else
 
 #include <linux/if_tunnel.h>
@@ -36,7 +60,7 @@ struct tnl_ptk_info {
 #define PACKET_RCVD    0
 #define PACKET_REJECT  1
 
-int iptunnel_xmit(struct rtable *rt,
+int iptunnel_xmit(struct sock *sk, struct rtable *rt,
                  struct sk_buff *skb,
                  __be32 src, __be32 dst, __u8 proto,
                  __u8 tos, __u8 ttl, __be16 df, bool xnet);
@@ -48,5 +72,6 @@ int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto);
 /* Not yet upstream */
 #define TUNNEL_OAM     __cpu_to_be16(0x0200)
 #define TUNNEL_CRIT_OPT        __cpu_to_be16(0x0400)
+#define TUNNEL_OPTIONS_PRESENT __cpu_to_be16(0x0800)
 
 #endif /* __NET_IP_TUNNELS_H */