logo       

[RFC] SNMP_ADD_STATS: msg#00070

Subject: [RFC] SNMP_ADD_STATS
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>