From 05a5321ec39b8f8bae0c2f0f7c2119de05173082 Mon Sep 17 00:00:00 2001 From: Jesse Gross Date: Fri, 15 Mar 2013 12:20:12 -0700 Subject: [PATCH] datapath: Provide additional RCU backports. A recent commit started using rcu_dereference_raw, hlist_first_rcu, and hlist_next_rcu so this provides backports for kernels where they don't exist. Signed-off-by: Jesse Gross --- datapath/linux/compat/include/linux/rculist.h | 7 +++++++ datapath/linux/compat/include/linux/rcupdate.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/datapath/linux/compat/include/linux/rculist.h b/datapath/linux/compat/include/linux/rculist.h index fd9bf10ed..365d1263e 100644 --- a/datapath/linux/compat/include/linux/rculist.h +++ b/datapath/linux/compat/include/linux/rculist.h @@ -7,6 +7,7 @@ #else /* Prior to 2.6.26, the contents of rculist.h were part of list.h. */ #include +#include #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) @@ -20,6 +21,12 @@ static inline void hlist_del_init_rcu(struct hlist_node *n) } #endif +#ifndef hlist_first_rcu +#define hlist_first_rcu(head) (*((struct hlist_node __rcu **)(&(head)->first))) +#define hlist_next_rcu(node) (*((struct hlist_node __rcu **)(&(node)->next))) +#define hlist_pprev_rcu(node) (*((struct hlist_node __rcu **)((node)->pprev))) +#endif + #undef hlist_for_each_entry_rcu #define hlist_for_each_entry_rcu(pos, head, member) \ for (pos = hlist_entry_safe (rcu_dereference_raw(hlist_first_rcu(head)),\ diff --git a/datapath/linux/compat/include/linux/rcupdate.h b/datapath/linux/compat/include/linux/rcupdate.h index 99459ea71..20cdedf05 100644 --- a/datapath/linux/compat/include/linux/rcupdate.h +++ b/datapath/linux/compat/include/linux/rcupdate.h @@ -11,6 +11,10 @@ #define rcu_dereference_protected(p, c) (p) #endif +#ifndef rcu_dereference_raw +#define rcu_dereference_raw(p) rcu_dereference_check(p, 1) +#endif + #ifndef HAVE_RCU_READ_LOCK_HELD static inline int rcu_read_lock_held(void) { -- 2.43.0