diff mbox

net: make xfrm_statistics_seq_show use generic snmp_fold_field

Message ID 200812291322.47467.rusty@rustcorp.com.au
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Rusty Russell Dec. 29, 2008, 2:52 a.m. UTC
No reason to roll our own here.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


Comments

David Miller Dec. 30, 2008, 2:20 a.m. UTC | #1
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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;
 }