Skip to content

Commit

Permalink
datapath: Improve robustness of this_cpu_ptr definition in compat layer
Browse files Browse the repository at this point in the history
Current autoconfig detection logic for HAVE_PER_CPU_PTR is not robust.
Depends on linux kernel version, the definition can be in either
linux/percpu.h or asm/percpu.h

Turns out it is simpler and safer to handle missing percpu.h
definitions in linux/percpu.h rather than asm/percpu.h. With this
change, there is no need for the autoconfig detection logic above.

Signed-off-by: Andy Zhou <[email protected]>
Acked-by: Pravin B Shelar <[email protected]>
  • Loading branch information
azhou-nicira committed Sep 15, 2014
1 parent 3bacde2 commit 00e01dd
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 13 deletions.
2 changes: 0 additions & 2 deletions acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,6 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [ADD_ALL_VLANS_CMD],
[OVS_DEFINE([HAVE_VLAN_BUG_WORKAROUND])])
OVS_GREP_IFELSE([$KSRC/include/linux/percpu.h], [this_cpu_ptr])
OVS_GREP_IFELSE([$KSRC/include/linux/u64_stats_sync.h], [u64_stats_fetch_begin_irq])
OVS_GREP_IFELSE([$KSRC/include/linux/openvswitch.h], [openvswitch_handle_frame_hook],
Expand Down
1 change: 0 additions & 1 deletion datapath/linux/Modules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ openvswitch_sources += \
openvswitch_headers += \
linux/compat/gso.h \
linux/compat/include/asm/hash.h \
linux/compat/include/asm/percpu.h \
linux/compat/include/linux/percpu.h \
linux/compat/include/linux/bug.h \
linux/compat/include/linux/compiler.h \
Expand Down
10 changes: 0 additions & 10 deletions datapath/linux/compat/include/asm/percpu.h

This file was deleted.

4 changes: 4 additions & 0 deletions datapath/linux/compat/include/linux/percpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

#include_next <linux/percpu.h>

#if !defined this_cpu_ptr
#define this_cpu_ptr(ptr) per_cpu_ptr(ptr, smp_processor_id())
#endif

#if !defined this_cpu_read
#define this_cpu_read(ptr) percpu_read(ptr)
#endif
Expand Down

0 comments on commit 00e01dd

Please sign in to comment.