netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: make xfrm_statistics_seq_show use generic snmp_fold_field
@ 2008-12-29  2:52 Rusty Russell
  2008-12-30  2:20 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Rusty Russell @ 2008-12-29  2:52 UTC (permalink / raw)
  To: netdev; +Cc: Masahide NAKAMURA

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: make xfrm_statistics_seq_show use generic snmp_fold_field
  2008-12-29  2:52 [PATCH] net: make xfrm_statistics_seq_show use generic snmp_fold_field Rusty Russell
@ 2008-12-30  2:20 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-12-30  2:20 UTC (permalink / raw)
  To: rusty; +Cc: netdev, nakam

From: Rusty Russell <rusty@rustcorp.com.au>
Date: Mon, 29 Dec 2008 13:22:47 +1030

> No reason to roll our own here.
> 
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Applied, thanks Rusty.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-12-30  2:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-29  2:52 [PATCH] net: make xfrm_statistics_seq_show use generic snmp_fold_field Rusty Russell
2008-12-30  2:20 ` David Miller

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).