diff options
Diffstat (limited to 'include/net/snmp.h')
-rw-r--r-- | include/net/snmp.h | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/include/net/snmp.h b/include/net/snmp.h index ea206bff0dc4..ce2f48507510 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #include <linux/cache.h> | 24 | #include <linux/cache.h> |
25 | #include <linux/snmp.h> | 25 | #include <linux/snmp.h> |
26 | #include <linux/smp.h> | ||
26 | 27 | ||
27 | /* | 28 | /* |
28 | * Mibs are stored in array of unsigned long. | 29 | * Mibs are stored in array of unsigned long. |
@@ -117,6 +118,11 @@ struct linux_mib { | |||
117 | unsigned long mibs[LINUX_MIB_MAX]; | 118 | unsigned long mibs[LINUX_MIB_MAX]; |
118 | }; | 119 | }; |
119 | 120 | ||
121 | /* Linux Xfrm */ | ||
122 | #define LINUX_MIB_XFRMMAX __LINUX_MIB_XFRMMAX | ||
123 | struct linux_xfrm_mib { | ||
124 | unsigned long mibs[LINUX_MIB_XFRMMAX]; | ||
125 | }; | ||
120 | 126 | ||
121 | /* | 127 | /* |
122 | * FIXME: On x86 and some other CPUs the split into user and softirq parts | 128 | * FIXME: On x86 and some other CPUs the split into user and softirq parts |
@@ -134,17 +140,27 @@ struct linux_mib { | |||
134 | 140 | ||
135 | #define SNMP_INC_STATS_BH(mib, field) \ | 141 | #define SNMP_INC_STATS_BH(mib, field) \ |
136 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field]++) | 142 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field]++) |
137 | #define SNMP_INC_STATS_OFFSET_BH(mib, field, offset) \ | ||
138 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field + (offset)]++) | ||
139 | #define SNMP_INC_STATS_USER(mib, field) \ | 143 | #define SNMP_INC_STATS_USER(mib, field) \ |
140 | (per_cpu_ptr(mib[1], raw_smp_processor_id())->mibs[field]++) | 144 | do { \ |
145 | per_cpu_ptr(mib[1], get_cpu())->mibs[field]++; \ | ||
146 | put_cpu(); \ | ||
147 | } while (0) | ||
141 | #define SNMP_INC_STATS(mib, field) \ | 148 | #define SNMP_INC_STATS(mib, field) \ |
142 | (per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id())->mibs[field]++) | 149 | do { \ |
150 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]++; \ | ||
151 | put_cpu(); \ | ||
152 | } while (0) | ||
143 | #define SNMP_DEC_STATS(mib, field) \ | 153 | #define SNMP_DEC_STATS(mib, field) \ |
144 | (per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id())->mibs[field]--) | 154 | do { \ |
155 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]--; \ | ||
156 | put_cpu(); \ | ||
157 | } while (0) | ||
145 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ | 158 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ |
146 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend) | 159 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend) |
147 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ | 160 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ |
148 | (per_cpu_ptr(mib[1], raw_smp_processor_id())->mibs[field] += addend) | 161 | do { \ |
162 | per_cpu_ptr(mib[1], get_cpu())->mibs[field] += addend; \ | ||
163 | put_cpu(); \ | ||
164 | } while (0) | ||
149 | 165 | ||
150 | #endif | 166 | #endif |