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 <az...@nicira.com>
---
 datapath/linux/Modules.mk              |  1 +
 datapath/linux/compat/include/percpu.h | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 datapath/linux/compat/include/percpu.h

diff --git a/datapath/linux/Modules.mk b/datapath/linux/Modules.mk
index 0b9fffa..95b52b2 100644
--- a/datapath/linux/Modules.mk
+++ b/datapath/linux/Modules.mk
@@ -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/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/percpu.h 
b/datapath/linux/compat/include/percpu.h
new file mode 100644
index 0000000..9731ce2
--- /dev/null
+++ b/datapath/linux/compat/include/percpu.h
@@ -0,0 +1,18 @@
+#ifndef __PERCPU_WRAPPER_H
+#define __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
-- 
1.9.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to