OVS_GREP_IFELSE([$KSRC/include/linux/err.h], [ERR_CAST])
OVS_GREP_IFELSE([$KSRC/include/linux/err.h], [IS_ERR_OR_NULL])
+ OVS_GREP_IFELSE([$KSRC/include/linux/hash.h], [fast_hash_ops])
OVS_GREP_IFELSE([$KSRC/include/linux/etherdevice.h], [eth_hw_addr_random])
OVS_GREP_IFELSE([$KSRC/include/linux/etherdevice.h], [ether_addr_copy])
OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_orphan_frags])
OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_get_hash])
OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_clear_hash])
+ OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [int.skb_zerocopy(],
+ [OVS_DEFINE([HAVE_SKB_ZEROCOPY])])
OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [l4_rxhash])
OVS_GREP_IFELSE([$KSRC/include/linux/types.h], [bool],
OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [genl_has_listeners])
OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [mcgrp_offset])
OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [parallel_ops])
+ OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [genlmsg_new_unicast])
OVS_GREP_IFELSE([$KSRC/include/net/gre.h], [gre_cisco_register])
+ OVS_GREP_IFELSE([$KSRC/include/net/gre.h], [gre_handle_offloads])
+ OVS_GREP_IFELSE([$KSRC/include/net/ip_tunnels.h], [iptunnel_xmit.*net],
+ [OVS_DEFINE([HAVE_IPTUNNEL_XMIT_NET])])
OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_get_be16])
OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_put_be16])
OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_put_be32])
struct sk_buff *user_skb = NULL; /* to be queued to userspace */
struct nlattr *nla;
struct genl_info info = {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)
+#ifdef HAVE_GENLMSG_NEW_UNICAST
.dst_sk = ovs_dp_get_net(dp)->genl_sock,
#endif
.snd_portid = upcall_info->portid,
#endif /* !HAVE_GRE_CISCO_REGISTER */
+#ifndef GRE_USE_KERNEL_GRE_HANDLE_OFFLOADS
+
/* GRE TX side. */
static void gre_csum_fix(struct sk_buff *skb)
{
}
}
}
+#endif
#endif /* CONFIG_NET_IPGRE_DEMUX */
#define _LINUX_HASH_WRAPPER_H
#include_next <linux/hash.h>
-
-#include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)
#include <asm/hash.h>
+#ifndef HAVE_FAST_HASH_OPS
+
struct fast_hash_ops {
u32 (*hash)(const void *data, u32 len, u32 seed);
u32 (*hash2)(const u32 *data, u32 len, u32 seed);
* Returns 32bit hash.
*/
extern u32 arch_fast_hash2(const u32 *data, u32 len, u32 seed);
-#endif /* < 3.14 */
+#endif /* !HASH_FAST_HASH_OPS */
#endif /* _LINUX_HASH_WRAPPER_H */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)
unsigned int skb_zerocopy_headlen(const struct sk_buff *from);
+#endif
+
+#ifndef HAVE_SKB_ZEROCOPY
+#define skb_zerocopy rpl_skb_zerocopy
int skb_zerocopy(struct sk_buff *to, struct sk_buff *from, int len,
int hlen);
#endif
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)
+#ifndef HAVE_GENLMSG_NEW_UNICAST
static inline struct sk_buff *genlmsg_new_unicast(size_t payload,
struct genl_info *info,
gfp_t flags)
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) */
#endif /* HAVE_GRE_CISCO_REGISTER */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)
+#ifndef GRE_USE_KERNEL_GRE_HANDLE_OFFLOADS
#define gre_build_header rpl_gre_build_header
void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
#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)
__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
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/udp.h>
+#include <net/gre.h>
#include <linux/version.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)
+#ifdef GRE_USE_KERNEL_GRE_HANDLE_OFFLOADS
#include_next <net/vxlan.h>
static inline int rpl_vxlan_xmit_skb(struct vxlan_sock *vs,
return vxlan_xmit_skb(vs, rt, skb, src, dst, tos, ttl, df,
src_port, dst_port, vni, false);
#else
+#ifndef HAVE_IPTUNNEL_XMIT_NET
return vxlan_xmit_skb(vs, rt, skb, src, dst, tos, ttl, df,
src_port, dst_port, vni);
+#else
+ return vxlan_xmit_skb(NULL, vs, rt, skb, src, dst, tos, ttl, df,
+ src_port, dst_port, vni);
+#endif
+
#endif
}
* 02110-1301, USA
*/
-#include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include "compat.h"
#include "gso.h"
+#ifndef GRE_USE_KERNEL_GRE_HANDLE_OFFLOADS
int iptunnel_xmit(struct sock *sk, struct rtable *rt,
struct sk_buff *skb,
__be32 src, __be32 dst, __u8 proto,
return 0;
}
-#endif /* 3.12 */
+#endif
return hlen;
}
+#ifndef HAVE_SKB_ZEROCOPY
/**
* skb_zerocopy - Zero copy skb to skb
* @to: destination buffer
return 0;
}
#endif
+#endif
*/
#include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <net/arp.h>
#include <net/ndisc.h>
#include <net/ip.h>
+#include <net/gre.h>
#include <net/ip_tunnels.h>
#include <net/icmp.h>
#include <net/udp.h>
#include "datapath.h"
#include "gso.h"
#include "vlan.h"
+#ifndef GRE_USE_KERNEL_GRE_HANDLE_OFFLOADS
#define VXLAN_HLEN (sizeof(struct udphdr) + sizeof(struct vxlanhdr))