* [RFC] SNMP_ADD_STATS
@ 2002-06-12 18:23 Arnaldo Carvalho de Melo
2002-06-12 22:47 ` kuznet
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2002-06-12 18:23 UTC (permalink / raw)
To: David S.Miller; +Cc: netdev
Hi,
I've been cleaning up the network stacks and one thing that made me
have a use for the barf bags I have handy is this type of construct:
ip_statistics[smp_processor_id()*2 + !in_softirq()].IpFragCreates += nfrags;
I've noticed that there is:
#define SNMP_INC_STATS(mib, field) ((mib)[2*smp_processor_id()+!in_softirq()].field++)
and
#define IP_INC_STATS(field) SNMP_INC_STATS(ip_statistics, field)
So I propose that we have
#define SNMP_ADD_STATS(mib, field, incr) ((mib)[2*smp_processor_id()+!in_softirq()].field += incr)
and
#define IP_ADD_STATS(field,incr) SNMP_ADD_STATS(ip_statistics, field, incr)
Any objections?
- Arnaldo
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [RFC] SNMP_ADD_STATS
2002-06-12 18:23 [RFC] SNMP_ADD_STATS Arnaldo Carvalho de Melo
@ 2002-06-12 22:47 ` kuznet
2002-06-12 22:58 ` David S. Miller
2002-06-13 0:11 ` Andi Kleen
2 siblings, 0 replies; 4+ messages in thread
From: kuznet @ 2002-06-12 22:47 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: netdev
Hello!
> Any objections?
No objections, of course. In any case, access to per-cpu stats is to be
macroized to work with preemption.
Alexey
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC] SNMP_ADD_STATS
2002-06-12 18:23 [RFC] SNMP_ADD_STATS Arnaldo Carvalho de Melo
2002-06-12 22:47 ` kuznet
@ 2002-06-12 22:58 ` David S. Miller
2002-06-13 0:11 ` Andi Kleen
2 siblings, 0 replies; 4+ messages in thread
From: David S. Miller @ 2002-06-12 22:58 UTC (permalink / raw)
To: acme; +Cc: netdev
From: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
Date: Wed, 12 Jun 2002 15:23:48 -0300
So I propose that we have
#define SNMP_ADD_STATS(mib, field, incr) ((mib)[2*smp_processor_id()+!in_softirq()].field += incr)
and
#define IP_ADD_STATS(field,incr) SNMP_ADD_STATS(ip_statistics, field, incr)
Any objections?
No problem.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC] SNMP_ADD_STATS
2002-06-12 18:23 [RFC] SNMP_ADD_STATS Arnaldo Carvalho de Melo
2002-06-12 22:47 ` kuznet
2002-06-12 22:58 ` David S. Miller
@ 2002-06-13 0:11 ` Andi Kleen
2 siblings, 0 replies; 4+ messages in thread
From: Andi Kleen @ 2002-06-13 0:11 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: David S.Miller, netdev
> #define IP_ADD_STATS(field,incr) SNMP_ADD_STATS(ip_statistics, field, incr)
>
> Any objections?
Better use per_cpu data in 2.5 (<asm/percpu.h>) for the MIBs.
That's much more efficient on some architectures, uses less memory on all
and is also cleaner.
-Andi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-06-13 0:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-12 18:23 [RFC] SNMP_ADD_STATS Arnaldo Carvalho de Melo
2002-06-12 22:47 ` kuznet
2002-06-12 22:58 ` David S. Miller
2002-06-13 0:11 ` Andi Kleen
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).