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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 11 Apr 2022 13:57:11 +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, linux@...linux.org.uk,
        jbrouer@...hat.com, ilias.apalodimas@...aro.org, jdamato@...tly.com
Subject: Re: [PATCH v3 net-next 1/2] net: page_pool: introduce ethtool stats

> diff --git a/include/net/page_pool.h b/include/net/page_pool.h
> index ea5fb70e5101..94b2d666db03 100644
> --- a/include/net/page_pool.h
> +++ b/include/net/page_pool.h
> @@ -117,6 +117,10 @@ struct page_pool_stats {
>  	struct page_pool_recycle_stats recycle_stats;
>  };
>  
> +int page_pool_ethtool_stats_get_count(void);
> +u8 *page_pool_ethtool_stats_get_strings(u8 *data);
> +u64 *page_pool_ethtool_stats_get(u64 *data, struct page_pool_stats *stats);
> +
>  /*
>   * Drivers that wish to harvest page pool stats and report them to users
>   * (perhaps via ethtool, debugfs, or another mechanism) can allocate a

You could also add stub function here for when the page pool
statistics are disabled. We can then avoid all the messy #ifdef in the
drivers.

> +u64 *page_pool_ethtool_stats_get(u64 *data, struct page_pool_stats *stats)
> +{
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(pp_stats); i++) {
> +		*data++ = stats->alloc_stats.fast;
> +		*data++ = stats->alloc_stats.slow;
> +		*data++ = stats->alloc_stats.slow_high_order;
> +		*data++ = stats->alloc_stats.empty;
> +		*data++ = stats->alloc_stats.refill;
> +		*data++ = stats->alloc_stats.waive;
> +		*data++ = stats->recycle_stats.cached;
> +		*data++ = stats->recycle_stats.cache_full;
> +		*data++ = stats->recycle_stats.ring;
> +		*data++ = stats->recycle_stats.ring_full;
> +		*data++ = stats->recycle_stats.released_refcnt;
> +	}
> +
> +	return data;

What is the purpose of the loop?

     Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ