diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-07-18 07:03:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-18 07:03:45 -0400 |
commit | 386019d3514b3ed9de8d0b05b67e638a7048375b (patch) | |
tree | 6447cb5bfe73788abab98f4835b95af258bfeeff | |
parent | 2f275f91a438abd8eec5321798d66a4ffe6869fa (diff) |
mib: put udplite statistics on struct net
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/netns/mib.h | 1 | ||||
-rw-r--r-- | include/net/udp.h | 5 | ||||
-rw-r--r-- | net/ipv4/af_inet.c | 11 | ||||
-rw-r--r-- | net/ipv4/proc.c | 2 | ||||
-rw-r--r-- | net/ipv4/udplite.c | 1 |
5 files changed, 10 insertions, 10 deletions
diff --git a/include/net/netns/mib.h b/include/net/netns/mib.h index 738c87ce183d..23e699fdb5cc 100644 --- a/include/net/netns/mib.h +++ b/include/net/netns/mib.h | |||
@@ -8,6 +8,7 @@ struct netns_mib { | |||
8 | DEFINE_SNMP_STAT(struct ipstats_mib, ip_statistics); | 8 | DEFINE_SNMP_STAT(struct ipstats_mib, ip_statistics); |
9 | DEFINE_SNMP_STAT(struct linux_mib, net_statistics); | 9 | DEFINE_SNMP_STAT(struct linux_mib, net_statistics); |
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 | }; | 12 | }; |
12 | 13 | ||
13 | #endif | 14 | #endif |
diff --git a/include/net/udp.h b/include/net/udp.h index ba5544152708..addcdc67234c 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
@@ -151,17 +151,16 @@ extern int udp_lib_setsockopt(struct sock *sk, int level, int optname, | |||
151 | DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6); | 151 | DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6); |
152 | 152 | ||
153 | /* UDP-Lite does not have a standardized MIB yet, so we inherit from UDP */ | 153 | /* UDP-Lite does not have a standardized MIB yet, so we inherit from UDP */ |
154 | DECLARE_SNMP_STAT(struct udp_mib, udplite_statistics); | ||
155 | DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6); | 154 | DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6); |
156 | 155 | ||
157 | /* | 156 | /* |
158 | * SNMP statistics for UDP and UDP-Lite | 157 | * SNMP statistics for UDP and UDP-Lite |
159 | */ | 158 | */ |
160 | #define UDP_INC_STATS_USER(net, field, is_udplite) do { \ | 159 | #define UDP_INC_STATS_USER(net, field, is_udplite) do { \ |
161 | if (is_udplite) SNMP_INC_STATS_USER(udplite_statistics, field); \ | 160 | if (is_udplite) SNMP_INC_STATS_USER((net)->mib.udplite_statistics, field); \ |
162 | else SNMP_INC_STATS_USER((net)->mib.udp_statistics, field); } while(0) | 161 | else SNMP_INC_STATS_USER((net)->mib.udp_statistics, field); } while(0) |
163 | #define UDP_INC_STATS_BH(net, field, is_udplite) do { \ | 162 | #define UDP_INC_STATS_BH(net, field, is_udplite) do { \ |
164 | if (is_udplite) SNMP_INC_STATS_BH(udplite_statistics, field); \ | 163 | if (is_udplite) SNMP_INC_STATS_BH((net)->mib.udplite_statistics, field); \ |
165 | else SNMP_INC_STATS_BH((net)->mib.udp_statistics, field); } while(0) | 164 | else SNMP_INC_STATS_BH((net)->mib.udp_statistics, field); } while(0) |
166 | 165 | ||
167 | #define UDP6_INC_STATS_BH(net, field, is_udplite) do { (void)net; \ | 166 | #define UDP6_INC_STATS_BH(net, field, is_udplite) do { (void)net; \ |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 1f418164ebf2..bf1f200c6575 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1352,10 +1352,15 @@ static __net_init int ipv4_mib_init_net(struct net *net) | |||
1352 | if (snmp_mib_init((void **)net->mib.udp_statistics, | 1352 | if (snmp_mib_init((void **)net->mib.udp_statistics, |
1353 | sizeof(struct udp_mib)) < 0) | 1353 | sizeof(struct udp_mib)) < 0) |
1354 | goto err_udp_mib; | 1354 | goto err_udp_mib; |
1355 | if (snmp_mib_init((void **)net->mib.udplite_statistics, | ||
1356 | sizeof(struct udp_mib)) < 0) | ||
1357 | goto err_udplite_mib; | ||
1355 | 1358 | ||
1356 | tcp_mib_init(net); | 1359 | tcp_mib_init(net); |
1357 | return 0; | 1360 | return 0; |
1358 | 1361 | ||
1362 | err_udplite_mib: | ||
1363 | snmp_mib_free((void **)net->mib.udp_statistics); | ||
1359 | err_udp_mib: | 1364 | err_udp_mib: |
1360 | snmp_mib_free((void **)net->mib.net_statistics); | 1365 | snmp_mib_free((void **)net->mib.net_statistics); |
1361 | err_net_mib: | 1366 | err_net_mib: |
@@ -1368,6 +1373,7 @@ err_tcp_mib: | |||
1368 | 1373 | ||
1369 | static __net_exit void ipv4_mib_exit_net(struct net *net) | 1374 | static __net_exit void ipv4_mib_exit_net(struct net *net) |
1370 | { | 1375 | { |
1376 | snmp_mib_free((void **)net->mib.udplite_statistics); | ||
1371 | snmp_mib_free((void **)net->mib.udp_statistics); | 1377 | snmp_mib_free((void **)net->mib.udp_statistics); |
1372 | snmp_mib_free((void **)net->mib.net_statistics); | 1378 | snmp_mib_free((void **)net->mib.net_statistics); |
1373 | snmp_mib_free((void **)net->mib.ip_statistics); | 1379 | snmp_mib_free((void **)net->mib.ip_statistics); |
@@ -1387,9 +1393,6 @@ static int __init init_ipv4_mibs(void) | |||
1387 | if (snmp_mib_init((void **)icmpmsg_statistics, | 1393 | if (snmp_mib_init((void **)icmpmsg_statistics, |
1388 | sizeof(struct icmpmsg_mib)) < 0) | 1394 | sizeof(struct icmpmsg_mib)) < 0) |
1389 | goto err_icmpmsg_mib; | 1395 | goto err_icmpmsg_mib; |
1390 | if (snmp_mib_init((void **)udplite_statistics, | ||
1391 | sizeof(struct udp_mib)) < 0) | ||
1392 | goto err_udplite_mib; | ||
1393 | 1396 | ||
1394 | if (register_pernet_subsys(&ipv4_mib_ops)) | 1397 | if (register_pernet_subsys(&ipv4_mib_ops)) |
1395 | goto err_net; | 1398 | goto err_net; |
@@ -1397,8 +1400,6 @@ static int __init init_ipv4_mibs(void) | |||
1397 | return 0; | 1400 | return 0; |
1398 | 1401 | ||
1399 | err_net: | 1402 | err_net: |
1400 | snmp_mib_free((void **)udplite_statistics); | ||
1401 | err_udplite_mib: | ||
1402 | snmp_mib_free((void **)icmpmsg_statistics); | 1403 | snmp_mib_free((void **)icmpmsg_statistics); |
1403 | err_icmpmsg_mib: | 1404 | err_icmpmsg_mib: |
1404 | snmp_mib_free((void **)icmp_statistics); | 1405 | snmp_mib_free((void **)icmp_statistics); |
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index 869085c8e43f..765418334b3c 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
@@ -385,7 +385,7 @@ static int snmp_seq_show(struct seq_file *seq, void *v) | |||
385 | seq_puts(seq, "\nUdpLite:"); | 385 | seq_puts(seq, "\nUdpLite:"); |
386 | for (i = 0; snmp4_udp_list[i].name != NULL; i++) | 386 | for (i = 0; snmp4_udp_list[i].name != NULL; i++) |
387 | seq_printf(seq, " %lu", | 387 | seq_printf(seq, " %lu", |
388 | snmp_fold_field((void **)udplite_statistics, | 388 | snmp_fold_field((void **)init_net.mib.udplite_statistics, |
389 | snmp4_udp_list[i].entry)); | 389 | snmp4_udp_list[i].entry)); |
390 | 390 | ||
391 | seq_putc(seq, '\n'); | 391 | seq_putc(seq, '\n'); |
diff --git a/net/ipv4/udplite.c b/net/ipv4/udplite.c index 4ad16b6d5138..3c807964da96 100644 --- a/net/ipv4/udplite.c +++ b/net/ipv4/udplite.c | |||
@@ -11,7 +11,6 @@ | |||
11 | * 2 of the License, or (at your option) any later version. | 11 | * 2 of the License, or (at your option) any later version. |
12 | */ | 12 | */ |
13 | #include "udp_impl.h" | 13 | #include "udp_impl.h" |
14 | DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics) __read_mostly; | ||
15 | 14 | ||
16 | struct hlist_head udplite_hash[UDP_HTABLE_SIZE]; | 15 | struct hlist_head udplite_hash[UDP_HTABLE_SIZE]; |
17 | 16 | ||