lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 23 Apr 2009 18:37:07 +0200
From:	Eric Dumazet <dada1@...mosbay.com>
To:	Neil Horman <nhorman@...driver.com>
CC:	David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH] snmp: add missing counters for RFC 4293

Neil Horman a écrit :
> On Wed, Apr 22, 2009 at 07:39:55PM +0200, Eric Dumazet wrote:
>> <previous contents snipped>
>>
> 
> 
> ok, new patch, functionally equivalent, with the following enhancements:
> 
> 1) Replaces INRECEIVES/OUTREQUESTS with INPKTS/OUTPKTS.  I did this
>    so that I could use the dual count update in (2) for INPKTS/INOCTETS
>    and OUTPKTS/OUTOCTETS
> 2) Added dual stat update routines for IP/IP6, named *_UPD_PO_STATS[_BH]
>    which updates a pair of stats, a P(acket) count, and an (O)ctet count
> 3) Added BCASTPKS/BCASTOCTETS for completeness
> 
> 
> 
> The IP MIB (RFC 4293) defines stats for InOctets, OutOctets, InMcastOctets and
> OutMcastOctets:
> http://tools.ietf.org/html/rfc4293
> But it seems we don't track those in any way that easy to separate from other
> protocols.  This patch adds those missing counters to the stats file. Tested
> successfully by me
> 
> Signed-off-by: Neil Horman <nhorman@...driver.com>
> 



> +#define SNMP_UPD_PO_STATS(mib, basefield, addend)	\
> +	do { \
> +		int __cpu = get_cpu(); \
> +		per_cpu_ptr(mib[!in_softirq()], __cpu)->mibs[basefield##PKTS]++; \
> +		per_cpu_ptr(mib[!in_softirq()], __cpu)->mibs[basefield##OCTETS] += addend;\
> +		put_cpu(); \
> +	} while (0)

Following should be faster, because per_cpu_ptr() and !in_softirq() factorization.

> +#define SNMP_UPD_PO_STATS(mib, basefield, addend)	\
> +	do { \
> +		__typeof__(mib[0]) ptr = per_cpu_ptr(mib[!in_softirq()], get_cpu()); \
> +		ptr->mibs[basefield##PKTS]++; \
> +		ptr->mibs[basefield##OCTETS] += addend;\
> +		put_cpu(); \
> +	} while (0)

BTW, we miss HC (64bits) values on 32bit arches, and some RFC (not 4293, but in 4113) mention they
 should be provided if counters can be updated more than 1 million times per second.

And for Octets counters, this is definitly the case with 100 Mbit networks... Oh well

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ