Netdev List
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: netdev@vger.kernel.org, lorenzo.bianconi@redhat.com,
	davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	thomas.petazzoni@bootlin.com, linux@armlinux.org.uk,
	jbrouer@redhat.com, jdamato@fastly.com, andrew@lunn.ch
Subject: Re: [PATCH v3 net-next 1/2] net: page_pool: introduce ethtool stats
Date: Mon, 11 Apr 2022 14:46:03 +0200	[thread overview]
Message-ID: <YlQjC7qpFXU7vmiH@lore-desk> (raw)
In-Reply-To: <CAC_iWj+fk4hkpBQE6SnusVHFJMoq3u40Hn2VK7uCmUADXM2MPQ@mail.gmail.com>

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

On Apr 11, Ilias Apalodimas wrote:
> On Mon, 11 Apr 2022 at 15:28, Lorenzo Bianconi <lorenzo@kernel.org> wrote:
> >
> > > Hi Lorenzo,
> >
> > Hi Ilias,
> >
> > >
> > > [...]
> > >
> > > >
> > > >         for_each_possible_cpu(cpu) {
> > > >                 const struct page_pool_recycle_stats *pcpu =
> > > > @@ -66,6 +87,47 @@ bool page_pool_get_stats(struct page_pool *pool,
> > > >         return true;
> > > >  }
> > > >  EXPORT_SYMBOL(page_pool_get_stats);
> > > > +
> > > > +u8 *page_pool_ethtool_stats_get_strings(u8 *data)
> > > > +{
> > > > +       int i;
> > > > +
> > > > +       for (i = 0; i < ARRAY_SIZE(pp_stats); i++) {
> > > > +               memcpy(data, pp_stats[i], ETH_GSTRING_LEN);
> > > > +               data += ETH_GSTRING_LEN;
> > > > +       }
> > > > +
> > > > +       return data;
> > >
> > > Is there a point returning data here or can we make this a void?
> >
> > it is to add the capability to add more strings in the driver code after
> > running page_pool_ethtool_stats_get_strings.
> 
> But the current driver isn't using it.  I don't have too much
> experience with how drivers consume ethtool stats, but would it make
> more sense to return a length instead of a pointer? Maybe Andrew has
> an idea.

yes, but it is for future usage. Returning a pointer modified by a
local routine is a common approach in the kernel (not sure about ethtool)
and it seems straightforward to me but len is fine as well. Opinions?

Regards,
Lorenzo

> 
> Thanks
> /Ilias
> >
> > >
> > > > +}
> > > > +EXPORT_SYMBOL(page_pool_ethtool_stats_get_strings);
> > > > +
> > > > +int page_pool_ethtool_stats_get_count(void)
> > > > +{
> > > > +       return ARRAY_SIZE(pp_stats);
> > > > +}
> > > > +EXPORT_SYMBOL(page_pool_ethtool_stats_get_count);
> > > > +
> > > > +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;
> > >
> > > Ditto
> >
> > same here.
> >
> > Regards,
> > Lorenzo
> >
> > >
> > > > +}
> > > > +EXPORT_SYMBOL(page_pool_ethtool_stats_get);
> > > >  #else
> > > >  #define alloc_stat_inc(pool, __stat)
> > > >  #define recycle_stat_inc(pool, __stat)
> > > > --
> > > > 2.35.1
> > > >
> > >
> > > Thanks
> > > /Ilias

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

  reply	other threads:[~2022-04-11 12:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-09 18:39 [PATCH v3 net-next 0/2] net: mvneta: add support for page_pool_get_stats Lorenzo Bianconi
2022-04-09 18:39 ` [PATCH v3 net-next 1/2] net: page_pool: introduce ethtool stats Lorenzo Bianconi
2022-04-11 11:57   ` Andrew Lunn
2022-04-11 12:27     ` Lorenzo Bianconi
2022-04-11 12:06   ` Ilias Apalodimas
2022-04-11 12:28     ` Lorenzo Bianconi
2022-04-11 12:34       ` Ilias Apalodimas
2022-04-11 12:46         ` Lorenzo Bianconi [this message]
2022-04-11 12:49         ` Andrew Lunn
2022-04-11 12:51           ` Ilias Apalodimas
2022-04-09 18:39 ` [PATCH v3 net-next 2/2] net: mvneta: add support for page_pool_get_stats Lorenzo Bianconi
2022-04-11 11:58   ` Andrew Lunn

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=YlQjC7qpFXU7vmiH@lore-desk \
    --to=lorenzo@kernel.org \
    --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=linux@armlinux.org.uk \
    --cc=lorenzo.bianconi@redhat.com \
    --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