diff options
-rw-r--r-- | include/net/icmp.h | 4 | ||||
-rw-r--r-- | include/net/netns/mib.h | 2 | ||||
-rw-r--r-- | include/net/snmp.h | 2 | ||||
-rw-r--r-- | net/ipv4/af_inet.c | 8 | ||||
-rw-r--r-- | net/ipv4/proc.c | 9 |
5 files changed, 12 insertions, 13 deletions
diff --git a/include/net/icmp.h b/include/net/icmp.h index f0698b955b73..75d615649071 100644 --- a/include/net/icmp.h +++ b/include/net/icmp.h | |||
@@ -31,8 +31,8 @@ struct icmp_err { | |||
31 | extern const struct icmp_err icmp_err_convert[]; | 31 | extern const struct icmp_err icmp_err_convert[]; |
32 | #define ICMP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmp_statistics, field) | 32 | #define ICMP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmp_statistics, field) |
33 | #define ICMP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.icmp_statistics, field) | 33 | #define ICMP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.icmp_statistics, field) |
34 | #define ICMPMSGOUT_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmpmsg_statistics, field+256) | 34 | #define ICMPMSGOUT_INC_STATS(net, field) SNMP_INC_STATS_ATOMIC_LONG((net)->mib.icmpmsg_statistics, field+256) |
35 | #define ICMPMSGIN_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.icmpmsg_statistics, field) | 35 | #define ICMPMSGIN_INC_STATS_BH(net, field) SNMP_INC_STATS_ATOMIC_LONG((net)->mib.icmpmsg_statistics, field) |
36 | 36 | ||
37 | struct dst_entry; | 37 | struct dst_entry; |
38 | struct net_proto_family; | 38 | struct net_proto_family; |
diff --git a/include/net/netns/mib.h b/include/net/netns/mib.h index 0b44112e2366..f360135cb69f 100644 --- a/include/net/netns/mib.h +++ b/include/net/netns/mib.h | |||
@@ -10,7 +10,7 @@ struct netns_mib { | |||
10 | DEFINE_SNMP_STAT(struct udp_mib, udp_statistics); | 10 | DEFINE_SNMP_STAT(struct udp_mib, udp_statistics); |
11 | DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics); | 11 | DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics); |
12 | DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics); | 12 | DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics); |
13 | DEFINE_SNMP_STAT(struct icmpmsg_mib, icmpmsg_statistics); | 13 | DEFINE_SNMP_STAT_ATOMIC(struct icmpmsg_mib, icmpmsg_statistics); |
14 | 14 | ||
15 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 15 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
16 | struct proc_dir_entry *proc_net_devsnmp6; | 16 | struct proc_dir_entry *proc_net_devsnmp6; |
diff --git a/include/net/snmp.h b/include/net/snmp.h index 8f0f9ac0307f..0feafa68da01 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h | |||
@@ -67,7 +67,7 @@ struct icmp_mib { | |||
67 | 67 | ||
68 | #define ICMPMSG_MIB_MAX __ICMPMSG_MIB_MAX | 68 | #define ICMPMSG_MIB_MAX __ICMPMSG_MIB_MAX |
69 | struct icmpmsg_mib { | 69 | struct icmpmsg_mib { |
70 | unsigned long mibs[ICMPMSG_MIB_MAX]; | 70 | atomic_long_t mibs[ICMPMSG_MIB_MAX]; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | /* ICMP6 (IPv6-ICMP) */ | 73 | /* ICMP6 (IPv6-ICMP) */ |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 1b5096a9875a..b2bbcd0ebd19 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1572,9 +1572,9 @@ static __net_init int ipv4_mib_init_net(struct net *net) | |||
1572 | sizeof(struct icmp_mib), | 1572 | sizeof(struct icmp_mib), |
1573 | __alignof__(struct icmp_mib)) < 0) | 1573 | __alignof__(struct icmp_mib)) < 0) |
1574 | goto err_icmp_mib; | 1574 | goto err_icmp_mib; |
1575 | if (snmp_mib_init((void __percpu **)net->mib.icmpmsg_statistics, | 1575 | net->mib.icmpmsg_statistics = kzalloc(sizeof(struct icmpmsg_mib), |
1576 | sizeof(struct icmpmsg_mib), | 1576 | GFP_KERNEL); |
1577 | __alignof__(struct icmpmsg_mib)) < 0) | 1577 | if (!net->mib.icmpmsg_statistics) |
1578 | goto err_icmpmsg_mib; | 1578 | goto err_icmpmsg_mib; |
1579 | 1579 | ||
1580 | tcp_mib_init(net); | 1580 | tcp_mib_init(net); |
@@ -1598,7 +1598,7 @@ err_tcp_mib: | |||
1598 | 1598 | ||
1599 | static __net_exit void ipv4_mib_exit_net(struct net *net) | 1599 | static __net_exit void ipv4_mib_exit_net(struct net *net) |
1600 | { | 1600 | { |
1601 | snmp_mib_free((void __percpu **)net->mib.icmpmsg_statistics); | 1601 | kfree(net->mib.icmpmsg_statistics); |
1602 | snmp_mib_free((void __percpu **)net->mib.icmp_statistics); | 1602 | snmp_mib_free((void __percpu **)net->mib.icmp_statistics); |
1603 | snmp_mib_free((void __percpu **)net->mib.udplite_statistics); | 1603 | snmp_mib_free((void __percpu **)net->mib.udplite_statistics); |
1604 | snmp_mib_free((void __percpu **)net->mib.udp_statistics); | 1604 | snmp_mib_free((void __percpu **)net->mib.udp_statistics); |
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index 466ea8bb7a4d..961eed4f510a 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
@@ -288,7 +288,7 @@ static void icmpmsg_put(struct seq_file *seq) | |||
288 | 288 | ||
289 | count = 0; | 289 | count = 0; |
290 | for (i = 0; i < ICMPMSG_MIB_MAX; i++) { | 290 | for (i = 0; i < ICMPMSG_MIB_MAX; i++) { |
291 | val = snmp_fold_field((void __percpu **) net->mib.icmpmsg_statistics, i); | 291 | val = atomic_long_read(&net->mib.icmpmsg_statistics->mibs[i]); |
292 | if (val) { | 292 | if (val) { |
293 | type[count] = i; | 293 | type[count] = i; |
294 | vals[count++] = val; | 294 | vals[count++] = val; |
@@ -307,6 +307,7 @@ static void icmp_put(struct seq_file *seq) | |||
307 | { | 307 | { |
308 | int i; | 308 | int i; |
309 | struct net *net = seq->private; | 309 | struct net *net = seq->private; |
310 | atomic_long_t *ptr = net->mib.icmpmsg_statistics->mibs; | ||
310 | 311 | ||
311 | seq_puts(seq, "\nIcmp: InMsgs InErrors"); | 312 | seq_puts(seq, "\nIcmp: InMsgs InErrors"); |
312 | for (i=0; icmpmibmap[i].name != NULL; i++) | 313 | for (i=0; icmpmibmap[i].name != NULL; i++) |
@@ -319,15 +320,13 @@ static void icmp_put(struct seq_file *seq) | |||
319 | snmp_fold_field((void __percpu **) net->mib.icmp_statistics, ICMP_MIB_INERRORS)); | 320 | snmp_fold_field((void __percpu **) net->mib.icmp_statistics, ICMP_MIB_INERRORS)); |
320 | for (i=0; icmpmibmap[i].name != NULL; i++) | 321 | for (i=0; icmpmibmap[i].name != NULL; i++) |
321 | seq_printf(seq, " %lu", | 322 | seq_printf(seq, " %lu", |
322 | snmp_fold_field((void __percpu **) net->mib.icmpmsg_statistics, | 323 | atomic_long_read(ptr + icmpmibmap[i].index)); |
323 | icmpmibmap[i].index)); | ||
324 | seq_printf(seq, " %lu %lu", | 324 | seq_printf(seq, " %lu %lu", |
325 | snmp_fold_field((void __percpu **) net->mib.icmp_statistics, ICMP_MIB_OUTMSGS), | 325 | snmp_fold_field((void __percpu **) net->mib.icmp_statistics, ICMP_MIB_OUTMSGS), |
326 | snmp_fold_field((void __percpu **) net->mib.icmp_statistics, ICMP_MIB_OUTERRORS)); | 326 | snmp_fold_field((void __percpu **) net->mib.icmp_statistics, ICMP_MIB_OUTERRORS)); |
327 | for (i=0; icmpmibmap[i].name != NULL; i++) | 327 | for (i=0; icmpmibmap[i].name != NULL; i++) |
328 | seq_printf(seq, " %lu", | 328 | seq_printf(seq, " %lu", |
329 | snmp_fold_field((void __percpu **) net->mib.icmpmsg_statistics, | 329 | atomic_long_read(ptr + (icmpmibmap[i].index | 0x100))); |
330 | icmpmibmap[i].index | 0x100)); | ||
331 | } | 330 | } |
332 | 331 | ||
333 | /* | 332 | /* |