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, 7 Apr 2022 20:25:44 +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: [RFC net-next 2/2] net: mvneta: add support for
 page_pool_get_stats

> +static void mvneta_ethtool_pp_stats(struct mvneta_port *pp, u64 *data)
> +{
> +	struct page_pool_stats stats = {};
> +	int i;
> +
> +	for (i = 0; i < rxq_number; i++) {
> +		struct page_pool *page_pool = pp->rxqs[i].page_pool;
> +		struct page_pool_stats pp_stats = {};
> +
> +		if (!page_pool_get_stats(page_pool, &pp_stats))
> +			continue;
> +
> +		stats.alloc_stats.fast += pp_stats.alloc_stats.fast;
> +		stats.alloc_stats.slow += pp_stats.alloc_stats.slow;
> +		stats.alloc_stats.slow_high_order +=
> +			pp_stats.alloc_stats.slow_high_order;
> +		stats.alloc_stats.empty += pp_stats.alloc_stats.empty;
> +		stats.alloc_stats.refill += pp_stats.alloc_stats.refill;
> +		stats.alloc_stats.waive += pp_stats.alloc_stats.waive;
> +		stats.recycle_stats.cached += pp_stats.recycle_stats.cached;
> +		stats.recycle_stats.cache_full +=
> +			pp_stats.recycle_stats.cache_full;
> +		stats.recycle_stats.ring += pp_stats.recycle_stats.ring;
> +		stats.recycle_stats.ring_full +=
> +			pp_stats.recycle_stats.ring_full;
> +		stats.recycle_stats.released_refcnt +=
> +			pp_stats.recycle_stats.released_refcnt;

We should be trying to remove this sort of code from the driver, and
put it all in the core.  It wants to be something more like:

	struct page_pool_stats stats = {};
	int i;

	for (i = 0; i < rxq_number; i++) {
		struct page_pool *page_pool = pp->rxqs[i].page_pool;

		if (!page_pool_get_stats(page_pool, &stats))
			continue;

	page_pool_ethtool_stats_get(data, &stats);

Let page_pool_get_stats() do the accumulate as it puts values in stats.

You probably should also rework the mellanox driver to use the same
code structure.

    Andrew

    

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ