diff options
-rw-r--r-- | include/net/snmp.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/include/net/snmp.h b/include/net/snmp.h index 9c5793db637f..fbb66663a42c 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. |
@@ -135,14 +136,26 @@ struct linux_mib { | |||
135 | #define SNMP_INC_STATS_BH(mib, field) \ | 136 | #define SNMP_INC_STATS_BH(mib, field) \ |
136 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field]++) | 137 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field]++) |
137 | #define SNMP_INC_STATS_USER(mib, field) \ | 138 | #define SNMP_INC_STATS_USER(mib, field) \ |
138 | (per_cpu_ptr(mib[1], raw_smp_processor_id())->mibs[field]++) | 139 | do { \ |
140 | per_cpu_ptr(mib[1], get_cpu())->mibs[field]++; \ | ||
141 | put_cpu(); \ | ||
142 | } while (0) | ||
139 | #define SNMP_INC_STATS(mib, field) \ | 143 | #define SNMP_INC_STATS(mib, field) \ |
140 | (per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id())->mibs[field]++) | 144 | do { \ |
145 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]++; \ | ||
146 | put_cpu(); \ | ||
147 | } while (0) | ||
141 | #define SNMP_DEC_STATS(mib, field) \ | 148 | #define SNMP_DEC_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_ADD_STATS_BH(mib, field, addend) \ | 153 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ |
144 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend) | 154 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend) |
145 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ | 155 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ |
146 | (per_cpu_ptr(mib[1], raw_smp_processor_id())->mibs[field] += addend) | 156 | do { \ |
157 | per_cpu_ptr(mib[1], get_cpu())->mibs[field] += addend; \ | ||
158 | put_cpu(); \ | ||
159 | } while (0) | ||
147 | 160 | ||
148 | #endif | 161 | #endif |