netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2][SCTP]: Use snmp_fold_field instead of a homebrew analogue.
@ 2008-02-08 11:04 Pavel Emelyanov
  2008-02-08 14:59 ` Vlad Yasevich
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Emelyanov @ 2008-02-08 11:04 UTC (permalink / raw)
  To: David Miller; +Cc: Vlad Yasevich, lksctp-developers, Linux Netdev List

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2][SCTP]: Use snmp_fold_field instead of a homebrew analogue.
  2008-02-08 11:04 [PATCH 1/2][SCTP]: Use snmp_fold_field instead of a homebrew analogue Pavel Emelyanov
@ 2008-02-08 14:59 ` Vlad Yasevich
  2008-02-10  7:24   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Vlad Yasevich @ 2008-02-08 14:59 UTC (permalink / raw)
  To: Pavel Emelyanov; +Cc: David Miller, lksctp-developers, Linux Netdev List

Pavel Emelyanov wrote:
> 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>

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2][SCTP]: Use snmp_fold_field instead of a homebrew analogue.
  2008-02-08 14:59 ` Vlad Yasevich
@ 2008-02-10  7:24   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2008-02-10  7:24 UTC (permalink / raw)
  To: vladislav.yasevich; +Cc: xemul, lksctp-developers, netdev

From: Vlad Yasevich <vladislav.yasevich@hp.com>
Date: Fri, 08 Feb 2008 09:59:54 -0500

> Pavel Emelyanov wrote:
> > 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>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-10  7:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-08 11:04 [PATCH 1/2][SCTP]: Use snmp_fold_field instead of a homebrew analogue Pavel Emelyanov
2008-02-08 14:59 ` Vlad Yasevich
2008-02-10  7:24   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).