netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Lorenzo Bianconi <lorenzo@kernel.org>,
	netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
	pabeni@redhat.com, thomas.petazzoni@bootlin.com,
	ilias.apalodimas@linaro.org, jbrouer@redhat.com,
	jdamato@fastly.com
Subject: Re: [PATCH v2 net-next 1/2] net: page_pool: introduce ethtool stats
Date: Fri, 8 Apr 2022 19:14:40 +0200	[thread overview]
Message-ID: <YlBtgF9vH5uJwmKY@lore-desk> (raw)
In-Reply-To: <YlA8kMKK3VpJTjxx@lunn.ch>

[-- Attachment #1: Type: text/plain, Size: 867 bytes --]

On Apr 08, Andrew Lunn wrote:
> > +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.

ack, I will fix it.

Regards,
Lorenzo

> 
>        Andrew
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2022-04-08 17:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-08  8:23 [PATCH v2 net-next 0/2] net: mvneta: add support for page_pool_get_stats Lorenzo Bianconi
2022-04-08  8:23 ` [PATCH v2 net-next 1/2] net: page_pool: introduce ethtool stats Lorenzo Bianconi
2022-04-08 13:33   ` Andrew Lunn
2022-04-08 13:45   ` Andrew Lunn
2022-04-08 17:14     ` Lorenzo Bianconi [this message]
2022-04-08  8:24 ` [PATCH v2 net-next 2/2] net: mvneta: add support for page_pool_get_stats Lorenzo Bianconi
2022-04-08 13:42   ` Andrew Lunn
2022-04-08 17:14     ` Lorenzo Bianconi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YlBtgF9vH5uJwmKY@lore-desk \
    --to=lorenzo.bianconi@redhat.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jbrouer@redhat.com \
    --cc=jdamato@fastly.com \
    --cc=kuba@kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).