[ovs-dev] [PATCH] datapath: Add this_cpu_{read, inc, dec} APIs for backward compatibility
Andy Zhou
azhou at nicira.com
Tue Sep 9 23:50:01 UTC 2014
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 at nicira.com>
---
datapath/linux/compat/include/asm/percpu.h | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/datapath/linux/compat/include/asm/percpu.h b/datapath/linux/compat/include/asm/percpu.h
index 65bce08..f68ef30 100644
--- a/datapath/linux/compat/include/asm/percpu.h
+++ b/datapath/linux/compat/include/asm/percpu.h
@@ -3,8 +3,24 @@
#include_next <asm/percpu.h>
-#if !defined this_cpu_ptr && !defined HAVE_THIS_CPU_PTR
+#if !defined HAVE_THIS_CPU_PTR
+
+#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
+
+#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 /* !defined HAVE_THIS_CPU_PTR */
+
#endif
--
1.9.1
More information about the dev
mailing list