Subject: Re: [RFC net-next 1/2] net: page_pool: introduce ethtool stats

From: Lorenzo Bianconi <[email-masked]>
Date: Fri, 8 Apr 2022 10:11:09 +0200

On Apr 07, Jakub Kicinski wrote:
> On Thu,  7 Apr 2022 18:55:04 +0200 Lorenzo Bianconi wrote:
> > +void page_pool_ethtool_stats_get_strings(u8 *data)
> 
> This needs to return the pointer to after the used area, so drivers can
> append more stats. Or make data double pointer and update it before
> returning.

ack, I will fix it in v2.

> 
> > +{
> > +	static const struct {
> > +		u8 type;
> > +		char name[ETH_GSTRING_LEN];
> > +	} stats[PP_ETHTOOL_STATS_MAX] = {
> > +		{
> > +			.type = PP_ETHTOOL_ALLOC_FAST,
> 
> Why enumerate the type? It's not used.

ack, I will fix it in v2.

Regards,
Lorenzo
> 
> > +			.name = "rx_pp_alloc_fast"
> > +		}, {
> > +			.type = PP_ETHTOOL_ALLOC_SLOW,
> > +			.name = "rx_pp_alloc_slow"
> > +		}, {
> > +			.type = PP_ETHTOOL_ALLOC_SLOW_HIGH_ORDER,
> > +			.name = "rx_pp_alloc_slow_ho"
> > +		}, {
> > +			.type = PP_ETHTOOL_ALLOC_EMPTY,
> > +			.name = "rx_pp_alloc_empty"
> > +		}, {
> > +			.type = PP_ETHTOOL_ALLOC_REFILL,
> > +			.name = "rx_pp_alloc_refill"
> > +		}, {
> > +			.type = PP_ETHTOOL_ALLOC_WAIVE,
> > +			.name = "rx_pp_alloc_waive"
> > +		}, {
> > +			.type = PP_ETHTOOL_RECYCLE_CACHED,
> > +			.name = "rx_pp_recycle_cached"
> > +		}, {
> > +			.type = PP_ETHTOOL_RECYCLE_CACHE_FULL,
> > +			.name = "rx_pp_recycle_cache_full"
> > +		}, {
> > +			.type = PP_ETHTOOL_RECYCLE_RING,
> > +			.name = "rx_pp_recycle_ring"
> > +		}, {
> > +			.type = PP_ETHTOOL_RECYCLE_RING_FULL,
> > +			.name = "rx_pp_recycle_ring_full"
> > +		}, {
> > +			.type = PP_ETHTOOL_RECYCLE_RELEASED_REF,
> > +			.name = "rx_pp_recycle_released_ref"
> > +		},
> > +	};
> > +	int i;
> > +
> > +	for (i = 0; i < PP_ETHTOOL_STATS_MAX; i++) {
> > +		memcpy(data, stats[i].name, ETH_GSTRING_LEN);
> > +		data += ETH_GSTRING_LEN;
> > +	}