From 138df3e563de9da0e5a4155b3534a69621495742 Mon Sep 17 00:00:00 2001 From: Greg Rose Date: Fri, 20 Apr 2018 11:13:07 -0700 Subject: [PATCH] compat: Fix upstream 4.4.119 kernel The Linux 4.4.119 kernel (and perhaps others) from kernel.org backports some dst_cache code that breaks the openvswitch kernel due to a duplicated name "dst_cache_destroy". For most cases the "USE_UPSTREAM_TUNNEL" covers this but in this case the dst_cache feature needs to be separated out. Add the necessary compatibility detection layer in acinclude.m4 and then fixup the source files so that if the built-in kernel includes dst_cache support then exclude our own compatibility code. Signed-off-by: Greg Rose Acked-by: Pravin B Shelar --- acinclude.m4 | 2 ++ datapath/linux/compat/dst_cache.c | 2 ++ datapath/linux/compat/include/net/dst_cache.h | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index dd264b39a..60186d33d 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -533,6 +533,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ [OVS_GREP_IFELSE([$KSRC/include/net/dst_cache.h], [dst_cache], [OVS_DEFINE([USE_UPSTREAM_TUNNEL])])])]) + OVS_GREP_IFELSE([$KSRC/include/net/dst_cache.h], [dst_cache], + [OVS_DEFINE([USE_BUILTIN_DST_CACHE])]) OVS_GREP_IFELSE([$KSRC/include/net/mpls.h], [mpls_hdr], [OVS_DEFINE([MPLS_HEADER_IS_L3])]) OVS_GREP_IFELSE([$KSRC/include/linux/net.h], [sock_create_kern.*net], diff --git a/datapath/linux/compat/dst_cache.c b/datapath/linux/compat/dst_cache.c index b93651670..45990cba7 100644 --- a/datapath/linux/compat/dst_cache.c +++ b/datapath/linux/compat/dst_cache.c @@ -9,6 +9,7 @@ * (at your option) any later version. */ +#ifndef USE_BUILTIN_DST_CACHE #include #include #include @@ -169,3 +170,4 @@ void rpl_dst_cache_destroy(struct dst_cache *dst_cache) } EXPORT_SYMBOL_GPL(rpl_dst_cache_destroy); #endif /*USE_UPSTREAM_TUNNEL */ +#endif /* USE_BUILTIN_DST_CACHE */ diff --git a/datapath/linux/compat/include/net/dst_cache.h b/datapath/linux/compat/include/net/dst_cache.h index ff4d83b83..6084d4eea 100644 --- a/datapath/linux/compat/include/net/dst_cache.h +++ b/datapath/linux/compat/include/net/dst_cache.h @@ -1,6 +1,10 @@ #ifndef _NET_DST_CACHE_WRAPPER_H #define _NET_DST_CACHE_WRAPPER_H +#ifdef USE_BUILTIN_DST_CACHE +#include_next +#else + #include #include #if IS_ENABLED(CONFIG_IPV6) @@ -106,4 +110,5 @@ int rpl_dst_cache_init(struct dst_cache *dst_cache, gfp_t gfp); void rpl_dst_cache_destroy(struct dst_cache *dst_cache); #endif /* USE_UPSTREAM_TUNNEL */ +#endif /* USE_BUILTIN_DST_CACHE */ #endif -- 2.39.5