netdev
[Top] [All Lists]

[RFC] SNMP_ADD_STATS

To: "David S.Miller" <davem@xxxxxxxxxx>
Subject: [RFC] SNMP_ADD_STATS
From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxxxxxxxx>
Date: Wed, 12 Jun 2002 15:23:48 -0300
Cc: netdev@xxxxxxxxxxx
Sender: owner-netdev@xxxxxxxxxxx
User-agent: Mutt/1.4i
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

<Prev in Thread] Current Thread [Next in Thread>