From: Eric Dumazet <dada1@cosmosbay.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH] snmp: add missing counters for RFC 4293
Date: Wed, 22 Apr 2009 19:39:55 +0200 [thread overview]
Message-ID: <49EF566B.70203@cosmosbay.com> (raw)
In-Reply-To: <20090422165034.GC17947@hmsreliant.think-freely.org>
Neil Horman a écrit :
> On Wed, Apr 22, 2009 at 02:50:03AM -0700, David Miller wrote:
>> From: Eric Dumazet <dada1@cosmosbay.com>
>> Date: Wed, 22 Apr 2009 11:35:45 +0200
>>
>>> So RFC4293 tells corresponding Octets variables should be supported :
>>>
>>> InOctets, InMcastOctets, OutMcastOctets, OutBcastOctets, OutOctets
>>>
>>> And I dont see them in /proc/net/snmp or /proc/net/netstat
>>>
>>> Mitsuru added :
>>>
>>> SNMP_MIB_ITEM("InNoRoutes", IPSTATS_MIB_INNOROUTES),
>>> SNMP_MIB_ITEM("InTruncatedPkts", IPSTATS_MIB_INTRUNCATEDPKTS),
>>> SNMP_MIB_ITEM("InMcastPkts", IPSTATS_MIB_INMCASTPKTS),
>>> SNMP_MIB_ITEM("OutMcastPkts", IPSTATS_MIB_OUTMCASTPKTS),
>>> SNMP_MIB_ITEM("InBcastPkts", IPSTATS_MIB_INBCASTPKTS),
>>> SNMP_MIB_ITEM("OutBcastPkts", IPSTATS_MIB_OUTBCASTPKTS),
>>>
>>> And Neil adds : InOctets, OutOctets, InMcastOctets and OutMcastOctets
>>>
>>> Neil, you forgot OutBcastOctets :)
>> Fair enough. Neil I wait for an updated patch :-)
>>
>
> As promised, new patch, tested and ready to go. This variant puts all the stats
> at the end of the IpExt stats line in /proc/net/snmp, and at the end of
> /proc/net/dev_snmp6/<iface>, so it shouldn't break any readers of those files.
>
> Also, Eric, I know you mentioned the need for OutBcastOctets, and intuitively I
> thought it should be there as well, but looking at RFC 4293, [In|Out]BcastOctets
> isn't defined. I started to wonder if perhaps the RFC assumed that McastOctets
> was assumed to include broadcast frames (i.e. all hosts multicast), but I
> decided that the smartest thing to do was correlate McastPkts and McastOctets.
> If someone wants to make an argument for including broadcast explicitly in both
> counters, then we can deal with that in a subsequent patch.
Yes, I found it on page 7, on diagram.
OutBcastPkts (1)
Legend (1) is : (1) The HC counters and octet counters are also found at these points
but have been left out for clarity.
So apparently RFC forgot OutBcastOctets/InBcastOctets somewhere, oh well...
We actually have
IpExt: InNoRoutes InTruncatedPkts InMcastPkts OutMcastPkts InBcastPkts OutBcastPkts
It would make sense to add : InOctets OutOctets InMcastOctets OutMcastOctets InBcastOctets OutBcastOctets
Even if not fully tagged in RFC...
You could actually use new macros, to update both packet count and bytes count at once.
(less calls to get_cpu()/put_cpu(), and per_cpu_ptr(), thats pretty expensive if CONFIG_PREEMPT
#define SNMP_ADD_PB_STATS(mib, bytesfield, bytes, packetsfield) \
do { __typeof__(mib) *ptr = per_cpu_ptr(mib[!in_softirq()], get_cpu()); \
ptr->mibs[bytesfield] += bytes; \
ptr->mibs[packetsfield]++; \
put_cpu(); \
} while (0)
#define SNMP_ADD_PB_STATS_BH(mib, bytesfield, bytes, packetsfield) \
do { __typeof__(mib) *ptr = per_cpu_ptr(mib[0], get_cpu()); \
ptr->mibs[bytesfield] += bytes; \
ptr->mibs[packetsfield]++; \
put_cpu(); \
} while (0)
PB as Packet & Bytes, maybe name is wrong :)
next prev parent reply other threads:[~2009-04-22 17:40 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-21 19:39 [PATCH] snmp: add missing counters for RFC 4293 Neil Horman
2009-04-21 19:58 ` Eric Dumazet
2009-04-21 20:09 ` Neil Horman
2009-04-21 20:45 ` Eric Dumazet
2009-04-21 23:03 ` Neil Horman
2009-04-22 1:12 ` Neil Horman
2009-04-22 5:15 ` Eric Dumazet
2009-04-22 9:08 ` David Miller
2009-04-22 9:35 ` Eric Dumazet
2009-04-22 9:50 ` David Miller
2009-04-22 10:53 ` Neil Horman
2009-04-22 16:50 ` Neil Horman
2009-04-22 17:39 ` Eric Dumazet [this message]
2009-04-22 18:44 ` Neil Horman
2009-04-23 15:28 ` Neil Horman
2009-04-23 16:37 ` Eric Dumazet
2009-04-23 16:56 ` Neil Horman
2009-04-23 17:13 ` Eric Dumazet
2009-04-23 17:25 ` Neil Horman
2009-04-23 17:32 ` Eric Dumazet
2009-04-23 18:28 ` Neil Horman
2009-04-24 14:10 ` Eric Dumazet
2009-04-24 17:06 ` Neil Horman
2009-04-24 18:37 ` Neil Horman
2009-04-27 9:45 ` David Miller
2009-04-22 5:17 ` Eric Dumazet
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=49EF566B.70203@cosmosbay.com \
--to=dada1@cosmosbay.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.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 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).