@@ -966,6 +966,10 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
OVS_FIND_PARAM_IFELSE([$KSRC/include/net/netfilter/nf_conntrack_helper.h],
[nf_ct_helper_ext_add], [nf_conntrack_helper],
[OVS_DEFINE([HAVE_NF_CT_HELPER_EXT_ADD_TAKES_HELPER])])
+ OVS_GREP_IFELSE([$KSRC/include/net/gre.h], [gre_calc_hlen],
+ [OVS_DEFINE([HAVE_GRE_CALC_HLEN])])
+ OVS_GREP_IFELSE([$KSRC/include/net/gre.h], [ip_gre_calc_hlen],
+ [OVS_DEFINE([HAVE_IP_GRE_CALC_HLEN])])
if cmp -s datapath/linux/kcompat.h.new \
datapath/linux/kcompat.h >/dev/null 2>&1; then
@@ -139,21 +139,6 @@ void rpl_gre_exit(void)
}
EXPORT_SYMBOL_GPL(rpl_gre_exit);
-#define ip_gre_calc_hlen rpl_ip_gre_calc_hlen
-#define gre_calc_hlen rpl_ip_gre_calc_hlen
-static int rpl_ip_gre_calc_hlen(__be16 o_flags)
-{
- int addend = 4;
-
- if (o_flags & TUNNEL_CSUM)
- addend += 4;
- if (o_flags & TUNNEL_KEY)
- addend += 4;
- if (o_flags & TUNNEL_SEQ)
- addend += 4;
- return addend;
-}
-
void rpl_gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
int hdr_len)
{
@@ -56,6 +56,27 @@ static inline struct net_device *rpl_gretap_fb_dev_create(
#else
#include_next <net/gre.h>
+#ifndef HAVE_GRE_CALC_HLEN
+static inline int gre_calc_hlen(__be16 o_flags)
+{
+ int addend = 4;
+
+ if (o_flags & TUNNEL_CSUM)
+ addend += 4;
+ if (o_flags & TUNNEL_KEY)
+ addend += 4;
+ if (o_flags & TUNNEL_SEQ)
+ addend += 4;
+ return addend;
+}
+
+#define ip_gre_calc_hlen gre_calc_hlen
+#else
+#ifdef HAVE_IP_GRE_CALC_HLEN
+#define gre_calc_hlen ip_gre_calc_hlen
+#endif
+#endif
+
#define tnl_flags_to_gre_flags rpl_tnl_flags_to_gre_flags
static inline __be16 rpl_tnl_flags_to_gre_flags(__be16 tflags)
{
@@ -83,20 +83,6 @@ static void ip6gre_tunnel_link(struct ip6gre_net *ign, struct ip6_tnl *t);
static void ip6gre_tnl_link_config(struct ip6_tnl *t, int set_mtu);
static void ip6erspan_tnl_link_config(struct ip6_tnl *t, int set_mtu);
-#define gre_calc_hlen rpl_ip_gre_calc_hlen
-static int rpl_ip_gre_calc_hlen(__be16 o_flags)
-{
- int addend = 4;
-
- if (o_flags & TUNNEL_CSUM)
- addend += 4;
- if (o_flags & TUNNEL_KEY)
- addend += 4;
- if (o_flags & TUNNEL_SEQ)
- addend += 4;
- return addend;
-}
-
/* Tunnel hash table */
/*
@@ -71,20 +71,6 @@ static void erspan_build_header(struct sk_buff *skb,
static bool ip_gre_loaded = false;
-#define ip_gre_calc_hlen rpl_ip_gre_calc_hlen
-static int ip_gre_calc_hlen(__be16 o_flags)
-{
- int addend = 4;
-
- if (o_flags & TUNNEL_CSUM)
- addend += 4;
- if (o_flags & TUNNEL_KEY)
- addend += 4;
- if (o_flags & TUNNEL_SEQ)
- addend += 4;
- return addend;
-}
-
/* Returns the least-significant 32 bits of a __be64. */
static __be32 tunnel_id_to_key(__be64 x)
{
@@ -100,6 +86,10 @@ struct dst_ops md_dst_ops = {
.family = AF_UNSPEC,
};
+#ifndef ip_gre_calc_hlen
+#define ip_gre_calc_hlen gre_calc_hlen
+#endif
+
static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi,
int gre_hdr_len)
{