aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sctp/proc.c')
-rw-r--r--net/sctp/proc.c31
1 files changed, 6 insertions, 25 deletions
diff --git a/net/sctp/proc.c b/net/sctp/proc.c
index 249973204070..69bb5a63fd8b 100644
--- a/net/sctp/proc.c
+++ b/net/sctp/proc.c
@@ -1,15 +1,15 @@
1/* SCTP kernel reference Implementation 1/* SCTP kernel implementation
2 * Copyright (c) 2003 International Business Machines, Corp. 2 * Copyright (c) 2003 International Business Machines, Corp.
3 * 3 *
4 * This file is part of the SCTP kernel reference Implementation 4 * This file is part of the SCTP kernel implementation
5 * 5 *
6 * The SCTP reference implementation is free software; 6 * This SCTP implementation is free software;
7 * you can redistribute it and/or modify it under the terms of 7 * you can redistribute it and/or modify it under the terms of
8 * the GNU General Public License as published by 8 * the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option) 9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version. 10 * any later version.
11 * 11 *
12 * The SCTP reference implementation is distributed in the hope that it 12 * This SCTP implementation is distributed in the hope that it
13 * will be useful, but WITHOUT ANY WARRANTY; without even the implied 13 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
14 * ************************ 14 * ************************
15 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@@ -38,6 +38,7 @@
38#include <linux/seq_file.h> 38#include <linux/seq_file.h>
39#include <linux/init.h> 39#include <linux/init.h>
40#include <net/sctp/sctp.h> 40#include <net/sctp/sctp.h>
41#include <net/ip.h> /* for snmp_fold_field */
41 42
42static struct snmp_mib sctp_snmp_list[] = { 43static struct snmp_mib sctp_snmp_list[] = {
43 SNMP_MIB_ITEM("SctpCurrEstab", SCTP_MIB_CURRESTAB), 44 SNMP_MIB_ITEM("SctpCurrEstab", SCTP_MIB_CURRESTAB),
@@ -75,26 +76,6 @@ static struct snmp_mib sctp_snmp_list[] = {
75 SNMP_MIB_SENTINEL 76 SNMP_MIB_SENTINEL
76}; 77};
77 78
78/* Return the current value of a particular entry in the mib by adding its
79 * per cpu counters.
80 */
81static unsigned long
82fold_field(void *mib[], int nr)
83{
84 unsigned long res = 0;
85 int i;
86
87 for_each_possible_cpu(i) {
88 res +=
89 *((unsigned long *) (((void *) per_cpu_ptr(mib[0], i)) +
90 sizeof (unsigned long) * nr));
91 res +=
92 *((unsigned long *) (((void *) per_cpu_ptr(mib[1], i)) +
93 sizeof (unsigned long) * nr));
94 }
95 return res;
96}
97
98/* Display sctp snmp mib statistics(/proc/net/sctp/snmp). */ 79/* Display sctp snmp mib statistics(/proc/net/sctp/snmp). */
99static int sctp_snmp_seq_show(struct seq_file *seq, void *v) 80static int sctp_snmp_seq_show(struct seq_file *seq, void *v)
100{ 81{
@@ -102,7 +83,7 @@ static int sctp_snmp_seq_show(struct seq_file *seq, void *v)
102 83
103 for (i = 0; sctp_snmp_list[i].name != NULL; i++) 84 for (i = 0; sctp_snmp_list[i].name != NULL; i++)
104 seq_printf(seq, "%-32s\t%ld\n", sctp_snmp_list[i].name, 85 seq_printf(seq, "%-32s\t%ld\n", sctp_snmp_list[i].name,
105 fold_field((void **)sctp_statistics, 86 snmp_fold_field((void **)sctp_statistics,
106 sctp_snmp_list[i].entry)); 87 sctp_snmp_list[i].entry));
107 88
108 return 0; 89 return 0;