datapath: Add conntrack action
[cascardo/ovs.git] / datapath / linux / compat / include / linux / percpu.h
1 #ifndef __LINUX_PERCPU_WRAPPER_H
2 #define __LINUX_PERCPU_WRAPPER_H 1
3
4 #include_next <linux/percpu.h>
5
6 #if !defined this_cpu_ptr
7 #define this_cpu_ptr(ptr) per_cpu_ptr(ptr, smp_processor_id())
8 #endif
9
10 #ifdef HAVE_RHEL6_PER_CPU
11 #undef this_cpu_read
12 #undef this_cpu_inc
13 #undef this_cpu_dec
14 #endif
15
16 #if !defined this_cpu_read
17 #define this_cpu_read(ptr) percpu_read(ptr)
18 #endif
19
20 #if !defined this_cpu_inc
21 #define this_cpu_inc(ptr) percpu_add(ptr, 1)
22 #endif
23
24 #if !defined this_cpu_dec
25 #define this_cpu_dec(ptr) percpu_sub(ptr, 1)
26 #endif
27
28 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)
29 #define get_pcpu_ptr(name) ((void *)this_cpu_ptr(&__pcpu_unique_##name))
30 #else
31 #define get_pcpu_ptr(name) (this_cpu_ptr(&name))
32 #endif
33
34 #endif