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: <YlA8kMKK3VpJTjxx@lunn.ch>
Date:   Fri, 8 Apr 2022 15:45:52 +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

> +u8 *page_pool_ethtool_stats_get_strings(u8 *data)
> +{
> +	static const char stats[PP_ETHTOOL_STATS_MAX][ETH_GSTRING_LEN] = {
> +		"rx_pp_alloc_fast",
> +		"rx_pp_alloc_slow",
> +		"rx_pp_alloc_slow_ho",
> +		"rx_pp_alloc_empty",
> +		"rx_pp_alloc_refill",
> +		"rx_pp_alloc_waive",
> +		"rx_pp_recycle_cached",
> +		"rx_pp_recycle_cache_full",
> +		"rx_pp_recycle_ring",
> +		"rx_pp_recycle_ring_full",
> +		"rx_pp_recycle_released_ref",
> +	};
> +	int i;
> +
> +	for (i = 0; i < PP_ETHTOOL_STATS_MAX; i++) {

I suggest you move this stats array out of the function, and then you
can use ARRAY_SIZE(stats) instead of PP_ETHTOOL_STATS_MAX. That is a
pretty common patters for ethtool statistics.

       Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ