From: Rusty Russell <rusty@rustcorp•com.au>
To: netdev@vger•kernel.org
Cc: Masahide NAKAMURA <nakam@linux-ipv6•org>
Subject: [PATCH] net: make xfrm_statistics_seq_show use generic snmp_fold_field
Date: Mon, 29 Dec 2008 13:22:47 +1030 [thread overview]
Message-ID: <200812291322.47467.rusty@rustcorp.com.au> (raw)
No reason to roll our own here.
Signed-off-by: Rusty Russell <rusty@rustcorp•com.au>
diff --git a/net/xfrm/xfrm_proc.c b/net/xfrm/xfrm_proc.c
--- a/net/xfrm/xfrm_proc.c
+++ b/net/xfrm/xfrm_proc.c
@@ -44,27 +44,14 @@ static struct snmp_mib xfrm_mib_list[] =
SNMP_MIB_SENTINEL
};
-static unsigned long
-fold_field(void *mib[], int offt)
-{
- unsigned long res = 0;
- int i;
-
- for_each_possible_cpu(i) {
- res += *(((unsigned long *)per_cpu_ptr(mib[0], i)) + offt);
- res += *(((unsigned long *)per_cpu_ptr(mib[1], i)) + offt);
- }
- return res;
-}
-
static int xfrm_statistics_seq_show(struct seq_file *seq, void *v)
{
struct net *net = seq->private;
int i;
for (i=0; xfrm_mib_list[i].name; i++)
seq_printf(seq, "%-24s\t%lu\n", xfrm_mib_list[i].name,
- fold_field((void **)net->mib.xfrm_statistics,
- xfrm_mib_list[i].entry));
+ snmp_fold_field((void **)net->mib.xfrm_statistics,
+ xfrm_mib_list[i].entry));
return 0;
}
\0
next reply other threads:[~2008-12-29 2:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-29 2:52 Rusty Russell [this message]
2008-12-30 2:20 ` [PATCH] net: make xfrm_statistics_seq_show use generic snmp_fold_field David Miller
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=200812291322.47467.rusty@rustcorp.com.au \
--to=rusty@rustcorp$(echo .)com.au \
--cc=nakam@linux-ipv6$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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