[SCTP]: Use snmp_fold_field instead of a homebrew analogue.

SCPT already depends in INET, so this doesn't create additional
dependencies.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Pavel Emelyanov and committed by David S. Miller 3f5340a6 cd557bc1

+2 -21
+2 -21
net/sctp/proc.c
··· 38 38 #include <linux/seq_file.h> 39 39 #include <linux/init.h> 40 40 #include <net/sctp/sctp.h> 41 + #include <net/ip.h> /* for snmp_fold_field */ 41 42 42 43 static struct snmp_mib sctp_snmp_list[] = { 43 44 SNMP_MIB_ITEM("SctpCurrEstab", SCTP_MIB_CURRESTAB), ··· 76 75 SNMP_MIB_SENTINEL 77 76 }; 78 77 79 - /* Return the current value of a particular entry in the mib by adding its 80 - * per cpu counters. 81 - */ 82 - static unsigned long 83 - fold_field(void *mib[], int nr) 84 - { 85 - unsigned long res = 0; 86 - int i; 87 - 88 - for_each_possible_cpu(i) { 89 - res += 90 - *((unsigned long *) (((void *) per_cpu_ptr(mib[0], i)) + 91 - sizeof (unsigned long) * nr)); 92 - res += 93 - *((unsigned long *) (((void *) per_cpu_ptr(mib[1], i)) + 94 - sizeof (unsigned long) * nr)); 95 - } 96 - return res; 97 - } 98 - 99 78 /* Display sctp snmp mib statistics(/proc/net/sctp/snmp). */ 100 79 static int sctp_snmp_seq_show(struct seq_file *seq, void *v) 101 80 { ··· 83 102 84 103 for (i = 0; sctp_snmp_list[i].name != NULL; i++) 85 104 seq_printf(seq, "%-32s\t%ld\n", sctp_snmp_list[i].name, 86 - fold_field((void **)sctp_statistics, 105 + snmp_fold_field((void **)sctp_statistics, 87 106 sctp_snmp_list[i].entry)); 88 107 89 108 return 0;