datapath: Backport this_cpu_ptr to kernels < 2.6.33
authorJesse Gross <jesse@nicira.com>
Fri, 16 Nov 2012 21:20:58 +0000 (13:20 -0800)
committerJesse Gross <jesse@nicira.com>
Fri, 16 Nov 2012 21:24:35 +0000 (13:24 -0800)
An upstream commit uses this_cpu_ptr for a small performance benefit,
so this provides an equivalent to kernels that don't have that
function.

Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath/linux/Modules.mk
datapath/linux/compat/include/asm/percpu.h [new file with mode: 0644]

index 14d23a4afc1b45f02e16053853b6a420126e0b2c..81556d510138870872aeb9c448ce0a756e9309eb 100644 (file)
@@ -13,6 +13,7 @@ openvswitch_sources += \
        linux/compat/time.c     \
        linux/compat/workqueue.c
 openvswitch_headers += \
+       linux/compat/include/asm/percpu.h \
        linux/compat/include/linux/bug.h \
        linux/compat/include/linux/compiler.h \
        linux/compat/include/linux/compiler-gcc.h \
diff --git a/datapath/linux/compat/include/asm/percpu.h b/datapath/linux/compat/include/asm/percpu.h
new file mode 100644 (file)
index 0000000..404b937
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef __ASM_PERCPU_WRAPPER_H
+#define __ASM_PERCPU_WRAPPER_H 1
+
+#include_next <asm/percpu.h>
+
+#ifndef this_cpu_ptr
+#define this_cpu_ptr(ptr) per_cpu_ptr(ptr, smp_processor_id())
+#endif
+
+#endif