From: Pavel Emelyanov <xemul@openvz.org>
To: David Miller <davem@davemloft.net>
Cc: Vlad Yasevich <vladislav.yasevich@hp.com>,
lksctp-developers@lists.sourceforge.net,
Linux Netdev List <netdev@vger.kernel.org>
Subject: [PATCH 1/2][SCTP]: Use snmp_fold_field instead of a homebrew analogue.
Date: Fri, 08 Feb 2008 14:04:55 +0300 [thread overview]
Message-ID: <47AC3757.6020405@openvz.org> (raw)
SCPT already depends in INET, so this doesn't create additional
dependencies.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
net/sctp/proc.c | 23 ++---------------------
1 files changed, 2 insertions(+), 21 deletions(-)
diff --git a/net/sctp/proc.c b/net/sctp/proc.c
index 2499732..974350b 100644
--- a/net/sctp/proc.c
+++ b/net/sctp/proc.c
@@ -38,6 +38,7 @@
#include <linux/seq_file.h>
#include <linux/init.h>
#include <net/sctp/sctp.h>
+#include <net/ip.h> /* for snmp_fold_field */
static struct snmp_mib sctp_snmp_list[] = {
SNMP_MIB_ITEM("SctpCurrEstab", SCTP_MIB_CURRESTAB),
@@ -75,26 +76,6 @@ static struct snmp_mib sctp_snmp_list[] = {
SNMP_MIB_SENTINEL
};
-/* Return the current value of a particular entry in the mib by adding its
- * per cpu counters.
- */
-static unsigned long
-fold_field(void *mib[], int nr)
-{
- unsigned long res = 0;
- int i;
-
- for_each_possible_cpu(i) {
- res +=
- *((unsigned long *) (((void *) per_cpu_ptr(mib[0], i)) +
- sizeof (unsigned long) * nr));
- res +=
- *((unsigned long *) (((void *) per_cpu_ptr(mib[1], i)) +
- sizeof (unsigned long) * nr));
- }
- return res;
-}
-
/* Display sctp snmp mib statistics(/proc/net/sctp/snmp). */
static int sctp_snmp_seq_show(struct seq_file *seq, void *v)
{
@@ -102,7 +83,7 @@ static int sctp_snmp_seq_show(struct seq_file *seq, void *v)
for (i = 0; sctp_snmp_list[i].name != NULL; i++)
seq_printf(seq, "%-32s\t%ld\n", sctp_snmp_list[i].name,
- fold_field((void **)sctp_statistics,
+ snmp_fold_field((void **)sctp_statistics,
sctp_snmp_list[i].entry));
return 0;
--
1.5.3.4
next reply other threads:[~2008-02-08 11:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-08 11:04 Pavel Emelyanov [this message]
2008-02-08 14:59 ` [PATCH 1/2][SCTP]: Use snmp_fold_field instead of a homebrew analogue Vlad Yasevich
2008-02-10 7:24 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47AC3757.6020405@openvz.org \
--to=xemul@openvz.org \
--cc=davem@davemloft.net \
--cc=lksctp-developers@lists.sourceforge.net \
--cc=netdev@vger.kernel.org \
--cc=vladislav.yasevich@hp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.