From: Pavel Emelyanov <xemul@openvz.org>
To: David Miller <davem@davemloft.net>
Cc: Linux Netdev List <netdev@vger.kernel.org>
Subject: [PATCH 8/16] mib: put icmp statistics on struct net
Date: Thu, 17 Jul 2008 17:31:10 +0400 [thread overview]
Message-ID: <487F499E.6050802@openvz.org> (raw)
In-Reply-To: <487F46CD.7090103@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
include/net/icmp.h | 5 ++---
include/net/netns/mib.h | 1 +
net/ipv4/af_inet.c | 11 ++++++-----
net/ipv4/icmp.c | 2 --
net/ipv4/proc.c | 8 ++++----
5 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 03b9972..e14f2c0 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -29,10 +29,9 @@ struct icmp_err {
};
extern struct icmp_err icmp_err_convert[];
-DECLARE_SNMP_STAT(struct icmp_mib, icmp_statistics);
DECLARE_SNMP_STAT(struct icmpmsg_mib, icmpmsg_statistics);
-#define ICMP_INC_STATS(net, field) SNMP_INC_STATS(icmp_statistics, field)
-#define ICMP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH(icmp_statistics, field)
+#define ICMP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.icmp_statistics, field)
+#define ICMP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.icmp_statistics, field)
#define ICMPMSGOUT_INC_STATS(net, field) SNMP_INC_STATS(icmpmsg_statistics, field+256)
#define ICMPMSGIN_INC_STATS_BH(net, field) SNMP_INC_STATS_BH(icmpmsg_statistics, field)
diff --git a/include/net/netns/mib.h b/include/net/netns/mib.h
index 23e699f..03f5abd 100644
--- a/include/net/netns/mib.h
+++ b/include/net/netns/mib.h
@@ -9,6 +9,7 @@ struct netns_mib {
DEFINE_SNMP_STAT(struct linux_mib, net_statistics);
DEFINE_SNMP_STAT(struct udp_mib, udp_statistics);
DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics);
+ DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics);
};
#endif
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index bf1f200..5c72bb3 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1355,10 +1355,15 @@ static __net_init int ipv4_mib_init_net(struct net *net)
if (snmp_mib_init((void **)net->mib.udplite_statistics,
sizeof(struct udp_mib)) < 0)
goto err_udplite_mib;
+ if (snmp_mib_init((void **)net->mib.icmp_statistics,
+ sizeof(struct icmp_mib)) < 0)
+ goto err_icmp_mib;
tcp_mib_init(net);
return 0;
+err_icmp_mib:
+ snmp_mib_free((void **)net->mib.udplite_statistics);
err_udplite_mib:
snmp_mib_free((void **)net->mib.udp_statistics);
err_udp_mib:
@@ -1373,6 +1378,7 @@ err_tcp_mib:
static __net_exit void ipv4_mib_exit_net(struct net *net)
{
+ snmp_mib_free((void **)net->mib.icmp_statistics);
snmp_mib_free((void **)net->mib.udplite_statistics);
snmp_mib_free((void **)net->mib.udp_statistics);
snmp_mib_free((void **)net->mib.net_statistics);
@@ -1387,9 +1393,6 @@ static __net_initdata struct pernet_operations ipv4_mib_ops = {
static int __init init_ipv4_mibs(void)
{
- if (snmp_mib_init((void **)icmp_statistics,
- sizeof(struct icmp_mib)) < 0)
- goto err_icmp_mib;
if (snmp_mib_init((void **)icmpmsg_statistics,
sizeof(struct icmpmsg_mib)) < 0)
goto err_icmpmsg_mib;
@@ -1402,8 +1405,6 @@ static int __init init_ipv4_mibs(void)
err_net:
snmp_mib_free((void **)icmpmsg_statistics);
err_icmpmsg_mib:
- snmp_mib_free((void **)icmp_statistics);
-err_icmp_mib:
return -ENOMEM;
}
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index ea60ad4..33f9589 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -114,7 +114,6 @@ struct icmp_bxm {
/*
* Statistics
*/
-DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics) __read_mostly;
DEFINE_SNMP_STAT(struct icmpmsg_mib, icmpmsg_statistics) __read_mostly;
/* An array of errno for error messages from dest unreach. */
@@ -1213,5 +1212,4 @@ int __init icmp_init(void)
EXPORT_SYMBOL(icmp_err_convert);
EXPORT_SYMBOL(icmp_send);
-EXPORT_SYMBOL(icmp_statistics);
EXPORT_SYMBOL(xrlim_allow);
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 7654183..6b43cce 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -311,15 +311,15 @@ static void icmp_put(struct seq_file *seq)
for (i=0; icmpmibmap[i].name != NULL; i++)
seq_printf(seq, " Out%s", icmpmibmap[i].name);
seq_printf(seq, "\nIcmp: %lu %lu",
- snmp_fold_field((void **) icmp_statistics, ICMP_MIB_INMSGS),
- snmp_fold_field((void **) icmp_statistics, ICMP_MIB_INERRORS));
+ snmp_fold_field((void **) init_net.mib.icmp_statistics, ICMP_MIB_INMSGS),
+ snmp_fold_field((void **) init_net.mib.icmp_statistics, ICMP_MIB_INERRORS));
for (i=0; icmpmibmap[i].name != NULL; i++)
seq_printf(seq, " %lu",
snmp_fold_field((void **) icmpmsg_statistics,
icmpmibmap[i].index));
seq_printf(seq, " %lu %lu",
- snmp_fold_field((void **) icmp_statistics, ICMP_MIB_OUTMSGS),
- snmp_fold_field((void **) icmp_statistics, ICMP_MIB_OUTERRORS));
+ snmp_fold_field((void **) init_net.mib.icmp_statistics, ICMP_MIB_OUTMSGS),
+ snmp_fold_field((void **) init_net.mib.icmp_statistics, ICMP_MIB_OUTERRORS));
for (i=0; icmpmibmap[i].name != NULL; i++)
seq_printf(seq, " %lu",
snmp_fold_field((void **) icmpmsg_statistics,
--
1.5.5.1
next prev parent reply other threads:[~2008-07-17 13:31 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-17 13:19 [PATCH 0/16] mib: finish with ipv4 mibs netnsization Pavel Emelyanov
2008-07-17 13:21 ` [PATCH 1/16] mib: add netns/mib.h file Pavel Emelyanov
2008-07-17 13:23 ` [PATCH 2/16] ipv4: add pernet mib operations Pavel Emelyanov
2008-07-17 13:25 ` [PATCH 3/16] mib: put tcp statistics on struct net Pavel Emelyanov
2008-07-17 13:26 ` [PATCH 4/16] mib: put ip " Pavel Emelyanov
2008-07-17 13:28 ` [PATCH 5/16] mib: put net " Pavel Emelyanov
2008-07-17 13:29 ` [PATCH 6/16] mib: put udp " Pavel Emelyanov
2008-07-17 13:30 ` [PATCH 7/16] mib: put udplite " Pavel Emelyanov
2008-07-17 13:31 ` Pavel Emelyanov [this message]
2008-07-17 13:32 ` [PATCH 9/16] mib: put icmpmsg " Pavel Emelyanov
2008-07-17 13:33 ` [PATCH 10/16] ipvs: clean the init_ipv4_mibs error paths Pavel Emelyanov
2008-07-17 13:35 ` [PATCH 11/16] proc: create /proc/net/netstat file in each net Pavel Emelyanov
2008-07-17 13:36 ` [PATCH 12/16] proc: create /proc/net/snmp " Pavel Emelyanov
2008-07-17 13:38 ` [PATCH 13/16] proc: show per-net ip_devconf.forwarding in /proc/net/snmp Pavel Emelyanov
2008-07-17 13:40 ` [PATCH 14/16] proc: clean the ip_misc_proc_init and ip_proc_init_net error paths Pavel Emelyanov
2008-07-17 13:41 ` [PATCH 15/16] proc: consolidate per-net single_open callers Pavel Emelyanov
2008-07-17 13:43 ` [PATCH 16/16] proc: consolidate per-net single-release callers Pavel Emelyanov
2008-07-18 11:09 ` [PATCH 0/16] mib: finish with ipv4 mibs netnsization David Miller
2008-07-21 17:38 ` Pavel Emelyanov
2008-07-22 0:24 ` Eric W. Biederman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=487F499E.6050802@openvz.org \
--to=xemul@openvz.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).