diff options
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/neighbour.h | 7 | ||||
-rw-r--r-- | include/net/netfilter/nf_conntrack.h | 4 | ||||
-rw-r--r-- | include/net/snmp.h | 50 |
3 files changed, 21 insertions, 40 deletions
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 0302f31a2fb7..b0173202cad9 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
@@ -88,12 +88,7 @@ struct neigh_statistics { | |||
88 | unsigned long unres_discards; /* number of unresolved drops */ | 88 | unsigned long unres_discards; /* number of unresolved drops */ |
89 | }; | 89 | }; |
90 | 90 | ||
91 | #define NEIGH_CACHE_STAT_INC(tbl, field) \ | 91 | #define NEIGH_CACHE_STAT_INC(tbl, field) this_cpu_inc((tbl)->stats->field) |
92 | do { \ | ||
93 | preempt_disable(); \ | ||
94 | (per_cpu_ptr((tbl)->stats, smp_processor_id())->field)++; \ | ||
95 | preempt_enable(); \ | ||
96 | } while (0) | ||
97 | 92 | ||
98 | struct neighbour { | 93 | struct neighbour { |
99 | struct neighbour *next; | 94 | struct neighbour *next; |
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 5cf7270e3ffc..a0904adfb8f7 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
@@ -293,11 +293,11 @@ extern unsigned int nf_conntrack_htable_size; | |||
293 | extern unsigned int nf_conntrack_max; | 293 | extern unsigned int nf_conntrack_max; |
294 | 294 | ||
295 | #define NF_CT_STAT_INC(net, count) \ | 295 | #define NF_CT_STAT_INC(net, count) \ |
296 | (per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++) | 296 | __this_cpu_inc((net)->ct.stat->count) |
297 | #define NF_CT_STAT_INC_ATOMIC(net, count) \ | 297 | #define NF_CT_STAT_INC_ATOMIC(net, count) \ |
298 | do { \ | 298 | do { \ |
299 | local_bh_disable(); \ | 299 | local_bh_disable(); \ |
300 | per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++; \ | 300 | __this_cpu_inc((net)->ct.stat->count); \ |
301 | local_bh_enable(); \ | 301 | local_bh_enable(); \ |
302 | } while (0) | 302 | } while (0) |
303 | 303 | ||
diff --git a/include/net/snmp.h b/include/net/snmp.h index 8c842e06bec8..f0d756f2ac99 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h | |||
@@ -136,45 +136,31 @@ struct linux_xfrm_mib { | |||
136 | #define SNMP_STAT_BHPTR(name) (name[0]) | 136 | #define SNMP_STAT_BHPTR(name) (name[0]) |
137 | #define SNMP_STAT_USRPTR(name) (name[1]) | 137 | #define SNMP_STAT_USRPTR(name) (name[1]) |
138 | 138 | ||
139 | #define SNMP_INC_STATS_BH(mib, field) \ | 139 | #define SNMP_INC_STATS_BH(mib, field) \ |
140 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field]++) | 140 | __this_cpu_inc(mib[0]->mibs[field]) |
141 | #define SNMP_INC_STATS_USER(mib, field) \ | 141 | #define SNMP_INC_STATS_USER(mib, field) \ |
142 | do { \ | 142 | this_cpu_inc(mib[1]->mibs[field]) |
143 | per_cpu_ptr(mib[1], get_cpu())->mibs[field]++; \ | 143 | #define SNMP_INC_STATS(mib, field) \ |
144 | put_cpu(); \ | 144 | this_cpu_inc(mib[!in_softirq()]->mibs[field]) |
145 | } while (0) | 145 | #define SNMP_DEC_STATS(mib, field) \ |
146 | #define SNMP_INC_STATS(mib, field) \ | 146 | this_cpu_dec(mib[!in_softirq()]->mibs[field]) |
147 | do { \ | 147 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ |
148 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]++; \ | 148 | __this_cpu_add(mib[0]->mibs[field], addend) |
149 | put_cpu(); \ | 149 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ |
150 | } while (0) | 150 | this_cpu_add(mib[1]->mibs[field], addend) |
151 | #define SNMP_DEC_STATS(mib, field) \ | ||
152 | do { \ | ||
153 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]--; \ | ||
154 | put_cpu(); \ | ||
155 | } while (0) | ||
156 | #define SNMP_ADD_STATS(mib, field, addend) \ | ||
157 | do { \ | ||
158 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field] += addend; \ | ||
159 | put_cpu(); \ | ||
160 | } while (0) | ||
161 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ | ||
162 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend) | ||
163 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ | ||
164 | do { \ | ||
165 | per_cpu_ptr(mib[1], get_cpu())->mibs[field] += addend; \ | ||
166 | put_cpu(); \ | ||
167 | } while (0) | ||
168 | #define SNMP_UPD_PO_STATS(mib, basefield, addend) \ | 151 | #define SNMP_UPD_PO_STATS(mib, basefield, addend) \ |
169 | do { \ | 152 | do { \ |
170 | __typeof__(mib[0]) ptr = per_cpu_ptr(mib[!in_softirq()], get_cpu());\ | 153 | __typeof__(mib[0]) ptr; \ |
154 | preempt_disable(); \ | ||
155 | ptr = this_cpu_ptr((mib)[!in_softirq()]); \ | ||
171 | ptr->mibs[basefield##PKTS]++; \ | 156 | ptr->mibs[basefield##PKTS]++; \ |
172 | ptr->mibs[basefield##OCTETS] += addend;\ | 157 | ptr->mibs[basefield##OCTETS] += addend;\ |
173 | put_cpu(); \ | 158 | preempt_enable(); \ |
174 | } while (0) | 159 | } while (0) |
175 | #define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ | 160 | #define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ |
176 | do { \ | 161 | do { \ |
177 | __typeof__(mib[0]) ptr = per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id());\ | 162 | __typeof__(mib[0]) ptr = \ |
163 | __this_cpu_ptr((mib)[!in_softirq()]); \ | ||
178 | ptr->mibs[basefield##PKTS]++; \ | 164 | ptr->mibs[basefield##PKTS]++; \ |
179 | ptr->mibs[basefield##OCTETS] += addend;\ | 165 | ptr->mibs[basefield##OCTETS] += addend;\ |
180 | } while (0) | 166 | } while (0) |