Enable ERSPAN on RHEL 7.x

Signed-off-by: Greg Rose <gvrose8...@gmail.com>
---
 acinclude.m4                    | 15 ++++++++++++++-
 datapath/linux/compat/ip6_gre.c | 13 ++++++-------
 datapath/linux/compat/ip_gre.c  | 12 ++++++------
 3 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 8962862..2351792 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -531,7 +531,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
                         [OVS_GREP_IFELSE([$KSRC/include/net/ip_tunnels.h],
                                          [iptunnel_pull_offloads],
                         [OVS_GREP_IFELSE([$KSRC/include/net/dst_cache.h], 
[dst_cache],
-                                         
[OVS_DEFINE([USE_UPSTREAM_TUNNEL])])])])
+                        [OVS_GREP_IFELSE([$KSRC/include/net/erspan.h], 
[erspan_md2],
+                                         
[OVS_DEFINE([USE_UPSTREAM_TUNNEL])])])])])
 
   OVS_GREP_IFELSE([$KSRC/include/net/dst_cache.h], [dst_cache],
                   [OVS_DEFINE([USE_BUILTIN_DST_CACHE])])
@@ -866,6 +867,18 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
   OVS_GREP_IFELSE([$KSRC/net/ipv4/gre_demux.c],
                   [parse_gre_header],
                   [OVS_DEFINE([HAVE_DEMUX_PARSE_GRE_HEADER])])
+  OVS_GREP_IFELSE([$KSRC/include/uapi/linux/if_tunnel.h],
+                  [IFLA_GRE_ENCAP_DPORT])
+  OVS_GREP_IFELSE([$KSRC/include/uapi/linux/if_tunnel.h],
+                  [IFLA_GRE_COLLECT_METADATA])
+  OVS_GREP_IFELSE([$KSRC/include/uapi/linux/if_tunnel.h],
+                  [IFLA_GRE_IGNORE_DF])
+  OVS_GREP_IFELSE([$KSRC/include/uapi/linux/if_tunnel.h],
+                  [IFLA_GRE_FWMARK])
+  OVS_GREP_IFELSE([$KSRC/include/uapi/linux/if_tunnel.h],
+                  [IFLA_GRE_ERSPAN_INDEX])
+  OVS_GREP_IFELSE([$KSRC/include/uapi/linux/if_tunnel.h],
+                  [IFLA_GRE_ERSPAN_HWID])
 
   if cmp -s datapath/linux/kcompat.h.new \
             datapath/linux/kcompat.h >/dev/null 2>&1; then
diff --git a/datapath/linux/compat/ip6_gre.c b/datapath/linux/compat/ip6_gre.c
index 59694dd..c48c389 100644
--- a/datapath/linux/compat/ip6_gre.c
+++ b/datapath/linux/compat/ip6_gre.c
@@ -1693,30 +1693,29 @@ static void __net_exit ip6gre_exit_batch_net(struct 
list_head *net_list)
 }
 
 enum {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
+#ifndef HAVE_IFLA_GRE_ENCAP_DPORT
        IFLA_GRE_ENCAP_TYPE = IFLA_GRE_FLAGS + 1,
        IFLA_GRE_ENCAP_FLAGS,
        IFLA_GRE_ENCAP_SPORT,
        IFLA_GRE_ENCAP_DPORT,
 #endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0)
+#ifndef HAVE_IFLA_GRE_COLLECT_METADATA
        IFLA_GRE_COLLECT_METADATA = IFLA_GRE_ENCAP_DPORT + 1,
 #endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+#ifndef HAVE_IFLA_GRE_IGNORE_DF
        IFLA_GRE_IGNORE_DF = IFLA_GRE_COLLECT_METADATA + 1,
 #endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0)
+#ifndef HAVE_IFLA_GRE_FWMARK
        IFLA_GRE_FWMARK = IFLA_GRE_IGNORE_DF + 1,
 #endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
+#ifndef HAVE_IFLA_GRE_ERSPAN_INDEX
        IFLA_GRE_ERSPAN_INDEX = IFLA_GRE_FWMARK + 1,
 #endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,16,0)
+#ifndef HAVE_IFLA_GRE_ERSPAN_HWID
        IFLA_GRE_ERSPAN_VER = IFLA_GRE_ERSPAN_INDEX + 1,
        IFLA_GRE_ERSPAN_DIR,
        IFLA_GRE_ERSPAN_HWID,
 #endif
-
 };
 
 #define RPL_IFLA_GRE_MAX (IFLA_GRE_ERSPAN_HWID + 1)
diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c
index 6001d69..eecd41a 100644
--- a/datapath/linux/compat/ip_gre.c
+++ b/datapath/linux/compat/ip_gre.c
@@ -814,25 +814,25 @@ out:
 }
 
 enum {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
+#ifndef HAVE_IFLA_GRE_ENCAP_DPORT
        IFLA_GRE_ENCAP_TYPE = IFLA_GRE_FLAGS + 1,
        IFLA_GRE_ENCAP_FLAGS,
        IFLA_GRE_ENCAP_SPORT,
        IFLA_GRE_ENCAP_DPORT,
 #endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0)
+#ifndef HAVE_IFLA_GRE_COLLECT_METADATA
        IFLA_GRE_COLLECT_METADATA = IFLA_GRE_ENCAP_DPORT + 1,
 #endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+#ifndef HAVE_IFLA_GRE_IGNORE_DF
        IFLA_GRE_IGNORE_DF = IFLA_GRE_COLLECT_METADATA + 1,
 #endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0)
+#ifndef HAVE_IFLA_GRE_FWMARK
        IFLA_GRE_FWMARK = IFLA_GRE_IGNORE_DF + 1,
 #endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
+#ifndef HAVE_IFLA_GRE_ERSPAN_INDEX
        IFLA_GRE_ERSPAN_INDEX = IFLA_GRE_FWMARK + 1,
 #endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,16,0)
+#ifndef HAVE_IFLA_GRE_ERSPAN_HWID
        IFLA_GRE_ERSPAN_VER = IFLA_GRE_ERSPAN_INDEX + 1,
        IFLA_GRE_ERSPAN_DIR,
        IFLA_GRE_ERSPAN_HWID,
-- 
1.8.3.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to