[ovs-dev] [V2 with ACKS 3/8] compat: Fixup ip_tunnel_info_opts_set

Greg Rose gvrose8192 at gmail.com
Thu Dec 13 23:08:20 UTC 2018


A new flags parameter has been added in 4.19 so add compat fixup.

Signed-off-by: Greg Rose <gvrose8192 at gmail.com>
Reviewed-by: Yifeng Sun <pkusunyifeng at gmail.com>
---
 acinclude.m4                                   |  3 +++
 datapath/linux/compat/include/net/ip_tunnels.h | 16 +++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/acinclude.m4 b/acinclude.m4
index ed83df4..92b4d6c 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -897,6 +897,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
                   [OVS_DEFINE([HAVE_VOID_NDO_GET_STATS64])])
   OVS_GREP_IFELSE([$KSRC/include/linux/timer.h], [init_timer_deferrable],
                   [OVS_DEFINE([HAVE_INIT_TIMER_DEFERRABLE])])
+  OVS_FIND_PARAM_IFELSE([$KSRC/include/net/ip_tunnels.h],
+                        [ip_tunnel_info_opts_set], [flags],
+                        [OVS_DEFINE([HAVE_IP_TUNNEL_INFO_OPTS_SET_FLAGS])])
 
   if cmp -s datapath/linux/kcompat.h.new \
             datapath/linux/kcompat.h >/dev/null 2>&1; then
diff --git a/datapath/linux/compat/include/net/ip_tunnels.h b/datapath/linux/compat/include/net/ip_tunnels.h
index ce6fca4..dd90306 100644
--- a/datapath/linux/compat/include/net/ip_tunnels.h
+++ b/datapath/linux/compat/include/net/ip_tunnels.h
@@ -13,7 +13,21 @@
 #define TUNNEL_ERSPAN_OPT	__cpu_to_be16(0x4000)
 #endif
 #define ovs_ip_tunnel_encap ip_tunnel_encap
-#else
+
+#ifndef HAVE_IP_TUNNEL_INFO_OPTS_SET_FLAGS
+static inline void rpl_ip_tunnel_info_opts_set(struct ip_tunnel_info *info,
+					       const void *from, int len,
+					       __be16 flags)
+{
+	memcpy(ip_tunnel_info_opts(info), from, len);
+	info->options_len = len;
+	info->key.tun_flags |= flags;
+}
+
+#define ip_tunnel_info_opts_set rpl_ip_tunnel_info_opts_set
+#endif
+
+#else /* USE_UPSTREAM_TUNNEL */
 
 #include <linux/if_tunnel.h>
 #include <linux/types.h>
-- 
1.8.3.1



More information about the dev mailing list