datapath: Add this_cpu_{read, inc, dec} APIs for backward compatibility
authorAndy Zhou <azhou@nicira.com>
Wed, 10 Sep 2014 20:22:08 +0000 (13:22 -0700)
committerAndy Zhou <azhou@nicira.com>
Wed, 10 Sep 2014 22:29:07 +0000 (15:29 -0700)
The upstream modules uses this_cpu_xxx APIs. Add those functions for
older kernel (<3.0.0) that does not provide them.

VMware-BZ: #1319082

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
datapath/linux/Modules.mk
datapath/linux/compat/include/linux/percpu.h [new file with mode: 0644]

index 0b9fffa..00922ed 100644 (file)
@@ -19,6 +19,7 @@ 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 \
        linux/compat/include/linux/compiler-gcc.h \
diff --git a/datapath/linux/compat/include/linux/percpu.h b/datapath/linux/compat/include/linux/percpu.h
new file mode 100644 (file)
index 0000000..9bd6801
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef __LINUX_PERCPU_WRAPPER_H
+#define __LINUX_PERCPU_WRAPPER_H 1
+
+#include_next <linux/percpu.h>
+
+#if !defined this_cpu_read
+#define this_cpu_read(ptr) percpu_read(ptr)
+#endif
+
+#if !defined this_cpu_inc
+#define this_cpu_inc(ptr) percpu_add(ptr, 1)
+#endif
+
+#if !defined this_cpu_dec
+#define this_cpu_dec(ptr) percpu_sub(ptr, 1)
+#endif
+
+#endif