datapath: Improve robustness of this_cpu_ptr definition in compat layer
authorAndy Zhou <azhou@nicira.com>
Wed, 10 Sep 2014 22:36:06 +0000 (15:36 -0700)
committerAndy Zhou <azhou@nicira.com>
Mon, 15 Sep 2014 07:21:21 +0000 (00:21 -0700)
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 <azhou@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
acinclude.m4
datapath/linux/Modules.mk
datapath/linux/compat/include/asm/percpu.h [deleted file]
datapath/linux/compat/include/linux/percpu.h

index e903273..e3a694b 100644 (file)
@@ -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],
index 00922ed..f7c64e2 100644 (file)
@@ -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 \
diff --git a/datapath/linux/compat/include/asm/percpu.h b/datapath/linux/compat/include/asm/percpu.h
deleted file mode 100644 (file)
index 65bce08..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __ASM_PERCPU_WRAPPER_H
-#define __ASM_PERCPU_WRAPPER_H 1
-
-#include_next <asm/percpu.h>
-
-#if !defined this_cpu_ptr && !defined HAVE_THIS_CPU_PTR
-#define this_cpu_ptr(ptr) per_cpu_ptr(ptr, smp_processor_id())
-#endif
-
-#endif
index 9bd6801..e0941f7 100644 (file)
@@ -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