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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 19 Jul 2022 12:18:36 +0200
From:   Lorenzo Bianconi <lorenzo.bianconi@...hat.com>
To:     Paolo Abeni <pabeni@...hat.com>
Cc:     Lorenzo Bianconi <lorenzo@...nel.org>, netdev@...r.kernel.org,
        nbd@....name, john@...ozen.org, sean.wang@...iatek.com,
        Mark-MC.Lee@...iatek.com, davem@...emloft.net, edumazet@...gle.com,
        kuba@...nel.org, matthias.bgg@...il.com,
        linux-mediatek@...ts.infradead.org, ilias.apalodimas@...aro.org,
        jbrouer@...hat.com
Subject: Re: [PATCH v3 net-next 5/5] net: ethernet: mtk_eth_soc: add support
 for page_pool_get_stats

> On Sat, 2022-07-16 at 09:34 +0200, Lorenzo Bianconi wrote:
> > Introduce support for the page_pool stats API into mtk_eth_soc driver.
> > Report page_pool stats through ethtool.
> > 
> > Signed-off-by: Lorenzo Bianconi <lorenzo@...nel.org>
> > ---
> >  drivers/net/ethernet/mediatek/Kconfig       |  1 +
> >  drivers/net/ethernet/mediatek/mtk_eth_soc.c | 40 +++++++++++++++++++--
> >  2 files changed, 38 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/mediatek/Kconfig b/drivers/net/ethernet/mediatek/Kconfig
> > index d2422c7b31b0..97374fb3ee79 100644
> > --- a/drivers/net/ethernet/mediatek/Kconfig
> > +++ b/drivers/net/ethernet/mediatek/Kconfig
> > @@ -18,6 +18,7 @@ config NET_MEDIATEK_SOC
> >  	select PHYLINK
> >  	select DIMLIB
> >  	select PAGE_POOL
> > +	select PAGE_POOL_STATS
> >  	help
> >  	  This driver supports the gigabit ethernet MACs in the
> >  	  MediaTek SoC family.
> > diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> > index abb8bc281015..eba95a86086d 100644
> > --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> > +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> > @@ -3517,11 +3517,19 @@ static void mtk_get_strings(struct net_device *dev, u32 stringset, u8 *data)
> >  	int i;
> >  
> >  	switch (stringset) {
> > -	case ETH_SS_STATS:
> > +	case ETH_SS_STATS: {
> > +		struct mtk_mac *mac = netdev_priv(dev);
> > +		struct mtk_eth *eth = mac->hw;
> > +
> >  		for (i = 0; i < ARRAY_SIZE(mtk_ethtool_stats); i++) {
> >  			memcpy(data, mtk_ethtool_stats[i].str, ETH_GSTRING_LEN);
> >  			data += ETH_GSTRING_LEN;
> >  		}
> > +		if (!eth->hwlro)
> 
> I see the page_pool is enabled if and only if !hwlro, but I think it
> would be more clear if you explicitly check for page_pool here (and in
> a few other places below), so that if the condition to enable page_pool
> someday will change, this code will still be fine.

Hi Paolo,

page_pool pointer is defined in mtk_rx_ring structure, so theoretically we can have a
page_pool defined for queue 0 but not for queues {1, 2, 3}. "!eth->hwlro" means
there is at least one page_pool allocated. Do you prefer to do something like:

bool mtk_is_pp_enabled(struct mtk_eth *eth)
{
	for (i = 0; i < ARRAY_SIZE(eth->rx_ring); i++) {
		struct mtk_rx_ring *ring = &eth->rx_ring[i];

		if (ring->page_pool)
			return true;
	}
	return false;
}

Regards,
Lorenzo

> 
> Thanks!
> 
> Paolo
> 

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ