Commit 91b208c7 authored by Rusty Russell's avatar Rusty Russell Committed by David S. Miller

net: make xfrm_statistics_seq_show use generic snmp_fold_field

No reason to roll our own here.
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2d0658d4
...@@ -44,27 +44,14 @@ static struct snmp_mib xfrm_mib_list[] = { ...@@ -44,27 +44,14 @@ static struct snmp_mib xfrm_mib_list[] = {
SNMP_MIB_SENTINEL 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) static int xfrm_statistics_seq_show(struct seq_file *seq, void *v)
{ {
struct net *net = seq->private; struct net *net = seq->private;
int i; int i;
for (i=0; xfrm_mib_list[i].name; i++) for (i=0; xfrm_mib_list[i].name; i++)
seq_printf(seq, "%-24s\t%lu\n", xfrm_mib_list[i].name, seq_printf(seq, "%-24s\t%lu\n", xfrm_mib_list[i].name,
fold_field((void **)net->mib.xfrm_statistics, snmp_fold_field((void **)net->mib.xfrm_statistics,
xfrm_mib_list[i].entry)); xfrm_mib_list[i].entry));
return 0; return 0;
} }
......
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