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]
Message-ID: <YlA5low6p+Hh1jBu@lunn.ch>
Date:   Fri, 8 Apr 2022 15:33:10 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Lorenzo Bianconi <lorenzo@...nel.org>
Cc:     netdev@...r.kernel.org, lorenzo.bianconi@...hat.com,
        davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
        thomas.petazzoni@...tlin.com, ilias.apalodimas@...aro.org,
        jbrouer@...hat.com, jdamato@...tly.com
Subject: Re: [PATCH v2 net-next 1/2] net: page_pool: introduce ethtool stats

> +/* List of page_pool stats exported through ethtool. */
> +enum {
> +	PP_ETHTOOL_ALLOC_FAST,
> +	PP_ETHTOOL_ALLOC_SLOW,
> +	PP_ETHTOOL_ALLOC_SLOW_HIGH_ORDER,
> +	PP_ETHTOOL_ALLOC_EMPTY,
> +	PP_ETHTOOL_ALLOC_REFILL,
> +	PP_ETHTOOL_ALLOC_WAIVE,
> +	PP_ETHTOOL_RECYCLE_CACHED,
> +	PP_ETHTOOL_RECYCLE_CACHE_FULL,
> +	PP_ETHTOOL_RECYCLE_RING,
> +	PP_ETHTOOL_RECYCLE_RING_FULL,
> +	PP_ETHTOOL_RECYCLE_RELEASED_REF,
> +	PP_ETHTOOL_STATS_MAX,

> +u64 *page_pool_ethtool_stats_get(u64 *data, struct page_pool_stats *stats)
> +{
> +	int i;
> +
> +	for (i = 0; i < PP_ETHTOOL_STATS_MAX; i++) {
> +		switch (i) {
> +		case PP_ETHTOOL_ALLOC_FAST:
> +			*data++ = stats->alloc_stats.fast;
> +			break;
> +		case PP_ETHTOOL_ALLOC_SLOW:
> +			*data++ = stats->alloc_stats.slow;
> +			break;
> +		case PP_ETHTOOL_ALLOC_SLOW_HIGH_ORDER:
> +			*data++ = stats->alloc_stats.slow_high_order;
> +			break;
> +		case PP_ETHTOOL_ALLOC_EMPTY:

What is the purpose of this enum? The order should be fixed, so just do:

			*data++ = stats->alloc_stats.fast;
			*data++ = stats->alloc_stats.slow;
			*data++ = stats->alloc_stats.slow_high_order;

and don't use the enum.

    Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ