Skip to content

Commit

Permalink
datapath: Provide additional RCU backports.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
jessegross committed Mar 15, 2013
1 parent c067cd1 commit 05a5321
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions datapath/linux/compat/include/linux/rculist.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#else
/* Prior to 2.6.26, the contents of rculist.h were part of list.h. */
#include <linux/list.h>
#include <linux/rcupdate.h>
#endif

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
Expand All @@ -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)),\
Expand Down
4 changes: 4 additions & 0 deletions datapath/linux/compat/include/linux/rcupdate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 05a5321

Please sign in to comment.