[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAC_iWjKttCb-oDk27vb_Ar58qLN8vY_1cFbGtLB+YUMXtTX8nw@mail.gmail.com>
Date: Thu, 7 Apr 2022 21:35:52 +0300
From: Ilias Apalodimas <ilias.apalodimas@...aro.org>
To: Andrew Lunn <andrew@...n.ch>
Cc: Lorenzo Bianconi <lorenzo@...nel.org>, netdev@...r.kernel.org,
lorenzo.bianconi@...hat.com, davem@...emloft.net, kuba@...nel.org,
pabeni@...hat.com, thomas.petazzoni@...tlin.com,
jbrouer@...hat.com, jdamato@...tly.com
Subject: Re: [RFC net-next 2/2] net: mvneta: add support for page_pool_get_stats
Hi Andrew,
On Thu, 7 Apr 2022 at 21:25, Andrew Lunn <andrew@...n.ch> wrote:
>
> > +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.
Unless I misunderstand this, I don't think that's doable in page pool.
That means page pool is aware of what stats to accumulate per driver
and I certainly don't want anything driver specific to creep in there.
The driver knows the number of pools he is using and he can gather
them all together.
Regards
/Ilias
>
> You probably should also rework the mellanox driver to use the same
> code structure.
>
> Andrew
>
>
Powered by blists - more mailing lists