aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/snmp.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/snmp.h')
-rw-r--r--include/net/snmp.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/include/net/snmp.h b/include/net/snmp.h
index a0e61806d480..479083a78b0c 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -60,9 +60,7 @@ struct ipstats_mib {
60}; 60};
61 61
62/* ICMP */ 62/* ICMP */
63#define ICMP_MIB_DUMMY __ICMP_MIB_MAX 63#define ICMP_MIB_MAX __ICMP_MIB_MAX
64#define ICMP_MIB_MAX (__ICMP_MIB_MAX + 1)
65
66struct icmp_mib { 64struct icmp_mib {
67 unsigned long mibs[ICMP_MIB_MAX]; 65 unsigned long mibs[ICMP_MIB_MAX];
68}; 66};
@@ -74,14 +72,24 @@ struct icmpmsg_mib {
74 72
75/* ICMP6 (IPv6-ICMP) */ 73/* ICMP6 (IPv6-ICMP) */
76#define ICMP6_MIB_MAX __ICMP6_MIB_MAX 74#define ICMP6_MIB_MAX __ICMP6_MIB_MAX
75/* per network ns counters */
77struct icmpv6_mib { 76struct icmpv6_mib {
78 unsigned long mibs[ICMP6_MIB_MAX]; 77 unsigned long mibs[ICMP6_MIB_MAX];
79}; 78};
79/* per device counters, (shared on all cpus) */
80struct icmpv6_mib_device {
81 atomic_long_t mibs[ICMP6_MIB_MAX];
82};
80 83
81#define ICMP6MSG_MIB_MAX __ICMP6MSG_MIB_MAX 84#define ICMP6MSG_MIB_MAX __ICMP6MSG_MIB_MAX
85/* per network ns counters */
82struct icmpv6msg_mib { 86struct icmpv6msg_mib {
83 unsigned long mibs[ICMP6MSG_MIB_MAX]; 87 unsigned long mibs[ICMP6MSG_MIB_MAX];
84}; 88};
89/* per device counters, (shared on all cpus) */
90struct icmpv6msg_mib_device {
91 atomic_long_t mibs[ICMP6MSG_MIB_MAX];
92};
85 93
86 94
87/* TCP */ 95/* TCP */
@@ -116,6 +124,8 @@ struct linux_xfrm_mib {
116 */ 124 */
117#define DEFINE_SNMP_STAT(type, name) \ 125#define DEFINE_SNMP_STAT(type, name) \
118 __typeof__(type) __percpu *name[2] 126 __typeof__(type) __percpu *name[2]
127#define DEFINE_SNMP_STAT_ATOMIC(type, name) \
128 __typeof__(type) *name
119#define DECLARE_SNMP_STAT(type, name) \ 129#define DECLARE_SNMP_STAT(type, name) \
120 extern __typeof__(type) __percpu *name[2] 130 extern __typeof__(type) __percpu *name[2]
121 131
@@ -126,6 +136,8 @@ struct linux_xfrm_mib {
126 __this_cpu_inc(mib[0]->mibs[field]) 136 __this_cpu_inc(mib[0]->mibs[field])
127#define SNMP_INC_STATS_USER(mib, field) \ 137#define SNMP_INC_STATS_USER(mib, field) \
128 this_cpu_inc(mib[1]->mibs[field]) 138 this_cpu_inc(mib[1]->mibs[field])
139#define SNMP_INC_STATS_ATOMIC_LONG(mib, field) \
140 atomic_long_inc(&mib->mibs[field])
129#define SNMP_INC_STATS(mib, field) \ 141#define SNMP_INC_STATS(mib, field) \
130 this_cpu_inc(mib[!in_softirq()]->mibs[field]) 142 this_cpu_inc(mib[!in_softirq()]->mibs[field])
131#define SNMP_DEC_STATS(mib, field) \ 143#define SNMP_DEC_STATS(mib, field) \
@@ -152,7 +164,7 @@ struct linux_xfrm_mib {
152#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ 164#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
153 do { \ 165 do { \
154 __typeof__(*mib[0]) *ptr = \ 166 __typeof__(*mib[0]) *ptr = \
155 __this_cpu_ptr((mib)[!in_softirq()]); \ 167 __this_cpu_ptr((mib)[0]); \
156 ptr->mibs[basefield##PKTS]++; \ 168 ptr->mibs[basefield##PKTS]++; \
157 ptr->mibs[basefield##OCTETS] += addend;\ 169 ptr->mibs[basefield##OCTETS] += addend;\
158 } while (0) 170 } while (0)
@@ -204,7 +216,7 @@ struct linux_xfrm_mib {
204#define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) \ 216#define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) \
205 do { \ 217 do { \
206 __typeof__(*mib[0]) *ptr; \ 218 __typeof__(*mib[0]) *ptr; \
207 ptr = __this_cpu_ptr((mib)[!in_softirq()]); \ 219 ptr = __this_cpu_ptr((mib)[0]); \
208 u64_stats_update_begin(&ptr->syncp); \ 220 u64_stats_update_begin(&ptr->syncp); \
209 ptr->mibs[basefield##PKTS]++; \ 221 ptr->mibs[basefield##PKTS]++; \
210 ptr->mibs[basefield##OCTETS] += addend; \ 222 ptr->mibs[basefield##OCTETS] += addend; \