summaryrefslogtreecommitdiff
path: root/datapath
diff options
context:
space:
mode:
authorYi-Hung Wei <yihung.wei@gmail.com>2018-12-14 15:28:55 -0800
committerBen Pfaff <blp@ovn.org>2018-12-18 12:16:32 -0800
commit8aef057be07fdb56e514d5e379fe4fa5d1ef66aa (patch)
tree8c3dc73a7408fc4fe45a3571d90ac3eb435c28c9 /datapath
parent250ed43465c7beeff171b6deb3e33a10d73be94a (diff)
downloadopenvswitch-8aef057be07fdb56e514d5e379fe4fa5d1ef66aa.tar.gz
datapath: compat: Fix static key backport
The original static key backport is based on the upstream net-next commit 11276d5306b8 ("locking/static_keys: Add a new static_key interface"). However, in Canonical's Trusty kernel, it introduced partial static support which have different definition of some of the macros that breaks the compatibility code. For example, in net-next git tree commit 11276d5306b8 ("locking/static_keys: Add a new static_key interface"). + #define DEFINE_STATIC_KEY_TRUE(name) \ + struct static_key_true name = STATIC_KEY_TRUE_INIT On the other hand, in Canonical's Trusty git tree commit 13f5d5d1cccb6 ("x86/KVM/VMX: Add module argument for L1TF mitigation") + #define DEFINE_STATIC_KEY_TRUE(name) \ + struct static_key name = STATIC_KEY_INIT_TRUE This commit resolves the ovs kernel module compatibility issue on Trusty kernel. VMware-BZ: #2251101 Fixes: 6660a9597a49 ("datapath: compat: Introduce static key support") Tested-by: Greg Rose <gvrose8192@gmail.com> Reviewed-by: Greg Rose <gvrose8192@gmail.com> Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'datapath')
-rw-r--r--datapath/linux/compat/include/linux/static_key.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/datapath/linux/compat/include/linux/static_key.h b/datapath/linux/compat/include/linux/static_key.h
index ea59e3e28..01c6a93f0 100644
--- a/datapath/linux/compat/include/linux/static_key.h
+++ b/datapath/linux/compat/include/linux/static_key.h
@@ -23,16 +23,16 @@ struct static_key_false {
#define rpl_STATIC_KEY_INIT_TRUE { .enabled = ATOMIC_INIT(1) }
#define rpl_STATIC_KEY_INIT_FALSE { .enabled = ATOMIC_INIT(0) }
-#define STATIC_KEY_TRUE_INIT \
+#define rpl_STATIC_KEY_TRUE_INIT \
(struct static_key_true) { .key = rpl_STATIC_KEY_INIT_TRUE, }
-#define STATIC_KEY_FALSE_INIT \
+#define rpl_STATIC_KEY_FALSE_INIT \
(struct static_key_false){ .key = rpl_STATIC_KEY_INIT_FALSE, }
-#define DEFINE_STATIC_KEY_TRUE(name) \
- struct static_key_true name = STATIC_KEY_TRUE_INIT
+#define rpl_DEFINE_STATIC_KEY_TRUE(name) \
+ struct static_key_true name = rpl_STATIC_KEY_TRUE_INIT
-#define DEFINE_STATIC_KEY_FALSE(name) \
- struct static_key_false name = STATIC_KEY_FALSE_INIT
+#define rpl_DEFINE_STATIC_KEY_FALSE(name) \
+ struct static_key_false name = rpl_STATIC_KEY_FALSE_INIT
static inline int rpl_static_key_count(struct static_key *key)
{
@@ -59,6 +59,14 @@ static inline void rpl_static_key_disable(struct static_key *key)
static_key_slow_dec(key);
}
+#ifdef HAVE_DEFINE_STATIC_KEY
+#undef DEFINE_STATIC_KEY_TRUE
+#undef DEFINE_STATIC_KEY_FALSE
+#endif
+
+#define DEFINE_STATIC_KEY_TRUE rpl_DEFINE_STATIC_KEY_TRUE
+#define DEFINE_STATIC_KEY_FALSE rpl_DEFINE_STATIC_KEY_FALSE
+
#define static_branch_likely(x) likely(static_key_enabled(&(x)->key))
#define static_branch_unlikely(x) unlikely(static_key_enabled(&(x)->key))