Commit 2f275f91 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by David S. Miller

mib: put udp statistics on struct net

Similar to... ouch, I repeat myself.
Signed-off-by: default avatarPavel Emelyanov <xemul@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 61a7e260
...@@ -7,6 +7,7 @@ struct netns_mib { ...@@ -7,6 +7,7 @@ struct netns_mib {
DEFINE_SNMP_STAT(struct tcp_mib, tcp_statistics); DEFINE_SNMP_STAT(struct tcp_mib, tcp_statistics);
DEFINE_SNMP_STAT(struct ipstats_mib, ip_statistics); DEFINE_SNMP_STAT(struct ipstats_mib, ip_statistics);
DEFINE_SNMP_STAT(struct linux_mib, net_statistics); DEFINE_SNMP_STAT(struct linux_mib, net_statistics);
DEFINE_SNMP_STAT(struct udp_mib, udp_statistics);
}; };
#endif #endif
...@@ -148,7 +148,6 @@ extern int udp_lib_setsockopt(struct sock *sk, int level, int optname, ...@@ -148,7 +148,6 @@ extern int udp_lib_setsockopt(struct sock *sk, int level, int optname,
char __user *optval, int optlen, char __user *optval, int optlen,
int (*push_pending_frames)(struct sock *)); int (*push_pending_frames)(struct sock *));
DECLARE_SNMP_STAT(struct udp_mib, udp_statistics);
DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6); DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6);
/* UDP-Lite does not have a standardized MIB yet, so we inherit from UDP */ /* UDP-Lite does not have a standardized MIB yet, so we inherit from UDP */
...@@ -158,12 +157,12 @@ DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6); ...@@ -158,12 +157,12 @@ DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6);
/* /*
* SNMP statistics for UDP and UDP-Lite * SNMP statistics for UDP and UDP-Lite
*/ */
#define UDP_INC_STATS_USER(net, field, is_udplite) do { (void)net; \ #define UDP_INC_STATS_USER(net, field, is_udplite) do { \
if (is_udplite) SNMP_INC_STATS_USER(udplite_statistics, field); \ if (is_udplite) SNMP_INC_STATS_USER(udplite_statistics, field); \
else SNMP_INC_STATS_USER(udp_statistics, field); } while(0) else SNMP_INC_STATS_USER((net)->mib.udp_statistics, field); } while(0)
#define UDP_INC_STATS_BH(net, field, is_udplite) do { (void)net; \ #define UDP_INC_STATS_BH(net, field, is_udplite) do { \
if (is_udplite) SNMP_INC_STATS_BH(udplite_statistics, field); \ if (is_udplite) SNMP_INC_STATS_BH(udplite_statistics, field); \
else SNMP_INC_STATS_BH(udp_statistics, field); } while(0) else SNMP_INC_STATS_BH((net)->mib.udp_statistics, field); } while(0)
#define UDP6_INC_STATS_BH(net, field, is_udplite) do { (void)net; \ #define UDP6_INC_STATS_BH(net, field, is_udplite) do { (void)net; \
if (is_udplite) SNMP_INC_STATS_BH(udplite_stats_in6, field); \ if (is_udplite) SNMP_INC_STATS_BH(udplite_stats_in6, field); \
......
...@@ -1349,10 +1349,15 @@ static __net_init int ipv4_mib_init_net(struct net *net) ...@@ -1349,10 +1349,15 @@ static __net_init int ipv4_mib_init_net(struct net *net)
if (snmp_mib_init((void **)net->mib.net_statistics, if (snmp_mib_init((void **)net->mib.net_statistics,
sizeof(struct linux_mib)) < 0) sizeof(struct linux_mib)) < 0)
goto err_net_mib; goto err_net_mib;
if (snmp_mib_init((void **)net->mib.udp_statistics,
sizeof(struct udp_mib)) < 0)
goto err_udp_mib;
tcp_mib_init(net); tcp_mib_init(net);
return 0; return 0;
err_udp_mib:
snmp_mib_free((void **)net->mib.net_statistics);
err_net_mib: err_net_mib:
snmp_mib_free((void **)net->mib.ip_statistics); snmp_mib_free((void **)net->mib.ip_statistics);
err_ip_mib: err_ip_mib:
...@@ -1363,6 +1368,7 @@ static __net_init int ipv4_mib_init_net(struct net *net) ...@@ -1363,6 +1368,7 @@ static __net_init int ipv4_mib_init_net(struct net *net)
static __net_exit void ipv4_mib_exit_net(struct net *net) static __net_exit void ipv4_mib_exit_net(struct net *net)
{ {
snmp_mib_free((void **)net->mib.udp_statistics);
snmp_mib_free((void **)net->mib.net_statistics); snmp_mib_free((void **)net->mib.net_statistics);
snmp_mib_free((void **)net->mib.ip_statistics); snmp_mib_free((void **)net->mib.ip_statistics);
snmp_mib_free((void **)net->mib.tcp_statistics); snmp_mib_free((void **)net->mib.tcp_statistics);
...@@ -1381,9 +1387,6 @@ static int __init init_ipv4_mibs(void) ...@@ -1381,9 +1387,6 @@ static int __init init_ipv4_mibs(void)
if (snmp_mib_init((void **)icmpmsg_statistics, if (snmp_mib_init((void **)icmpmsg_statistics,
sizeof(struct icmpmsg_mib)) < 0) sizeof(struct icmpmsg_mib)) < 0)
goto err_icmpmsg_mib; goto err_icmpmsg_mib;
if (snmp_mib_init((void **)udp_statistics,
sizeof(struct udp_mib)) < 0)
goto err_udp_mib;
if (snmp_mib_init((void **)udplite_statistics, if (snmp_mib_init((void **)udplite_statistics,
sizeof(struct udp_mib)) < 0) sizeof(struct udp_mib)) < 0)
goto err_udplite_mib; goto err_udplite_mib;
...@@ -1396,8 +1399,6 @@ static int __init init_ipv4_mibs(void) ...@@ -1396,8 +1399,6 @@ static int __init init_ipv4_mibs(void)
err_net: err_net:
snmp_mib_free((void **)udplite_statistics); snmp_mib_free((void **)udplite_statistics);
err_udplite_mib: err_udplite_mib:
snmp_mib_free((void **)udp_statistics);
err_udp_mib:
snmp_mib_free((void **)icmpmsg_statistics); snmp_mib_free((void **)icmpmsg_statistics);
err_icmpmsg_mib: err_icmpmsg_mib:
snmp_mib_free((void **)icmp_statistics); snmp_mib_free((void **)icmp_statistics);
......
...@@ -374,7 +374,7 @@ static int snmp_seq_show(struct seq_file *seq, void *v) ...@@ -374,7 +374,7 @@ static int snmp_seq_show(struct seq_file *seq, void *v)
seq_puts(seq, "\nUdp:"); seq_puts(seq, "\nUdp:");
for (i = 0; snmp4_udp_list[i].name != NULL; i++) for (i = 0; snmp4_udp_list[i].name != NULL; i++)
seq_printf(seq, " %lu", seq_printf(seq, " %lu",
snmp_fold_field((void **)udp_statistics, snmp_fold_field((void **)init_net.mib.udp_statistics,
snmp4_udp_list[i].entry)); snmp4_udp_list[i].entry));
/* the UDP and UDP-Lite MIBs are the same */ /* the UDP and UDP-Lite MIBs are the same */
......
...@@ -108,9 +108,6 @@ ...@@ -108,9 +108,6 @@
* Snmp MIB for the UDP layer * Snmp MIB for the UDP layer
*/ */
DEFINE_SNMP_STAT(struct udp_mib, udp_statistics) __read_mostly;
EXPORT_SYMBOL(udp_statistics);
DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6) __read_mostly; DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6) __read_mostly;
EXPORT_SYMBOL(udp_stats_in6); EXPORT_SYMBOL(udp_stats_in6);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment