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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
 <PAXPR04MB9185737222043AD4AE672D6B896F2@PAXPR04MB9185.eurprd04.prod.outlook.com>
Date: Mon, 23 Sep 2024 16:18:00 +0000
From: Shenwei Wang <shenwei.wang@....com>
To: Serge Semin <fancer.lancer@...il.com>
CC: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
	<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
	<pabeni@...hat.com>, Maxime Coquelin <mcoquelin.stm32@...il.com>,
	"horms@...nel.org" <horms@...nel.org>, Alexandre Torgue
	<alexandre.torgue@...s.st.com>, Jose Abreu <joabreu@...opsys.com>, Ong Boon
 Leong <boon.leong.ong@...el.com>, Wong Vee Khee <vee.khee.wong@...el.com>,
	Chuah Kim Tatt <kim.tatt.chuah@...el.com>, "netdev@...r.kernel.org"
	<netdev@...r.kernel.org>, "linux-stm32@...md-mailman.stormreply.com"
	<linux-stm32@...md-mailman.stormreply.com>,
	"linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "imx@...ts.linux.dev"
	<imx@...ts.linux.dev>, dl-linux-imx <linux-imx@....com>
Subject: Re: [PATCH v2 net] net: stmmac: dwmac4: extend timeout for VLAN Tag
 register busy bit check



> -----Original Message-----
> From: Serge Semin <fancer.lancer@...il.com>
> Sent: Sunday, September 22, 2024 5:18 PM
> To: Shenwei Wang <shenwei.wang@....com>
> Cc: David S. Miller <davem@...emloft.net>; Eric Dumazet
> <edumazet@...gle.com>; Jakub Kicinski <kuba@...nel.org>; Paolo Abeni
> <pabeni@...hat.com>; Maxime Coquelin <mcoquelin.stm32@...il.com>;
> horms@...nel.org; Alexandre Torgue <alexandre.torgue@...s.st.com>; Jose
> Abreu <joabreu@...opsys.com>; Ong Boon Leong <boon.leong.ong@...el.com>;
> Wong Vee Khee <vee.khee.wong@...el.com>; Chuah Kim Tatt
> <kim.tatt.chuah@...el.com>; netdev@...r.kernel.org; linux-stm32@...md-
> mailman.stormreply.com; linux-arm-kernel@...ts.infradead.org;
> imx@...ts.linux.dev; dl-linux-imx <linux-imx@....com>
> Subject: [EXT] Re: [PATCH v2 net] net: stmmac: dwmac4: extend timeout for
> VLAN Tag register busy bit check
> >
> > -     for (i = 0; i < timeout; i++) {
> > -             val = readl(ioaddr + GMAC_VLAN_TAG);
> > -             if (!(val & GMAC_VLAN_TAG_CTRL_OB))
> > -                     return 0;
> > -             udelay(1);
> > -     }
> 
> > +     ret = readl_poll_timeout(ioaddr + GMAC_VLAN_TAG, val,
> > +                              !(val & GMAC_VLAN_TAG_CTRL_OB),
> > +                              1000, timeout);
> > +     if (!ret)
> > +             return 0;
> >
> >       netdev_err(dev, "Timeout accessing MAC_VLAN_Tag_Filter\n");
> 
> 1. Just drop the timeout local variable and use the 500000 literal directly. There is
> no point in such parametrization especially you have already added the delay as
> is.
> 
> 2. A more traditional, readable and maintainable pattern is the error-check
> statement after the call. So seeing you are changing this part of the method
> anyway, let's convert it to:
> 
> +       ret = readl_poll_timeout(ioaddr + GMAC_VLAN_TAG, val,
> +                                !(val & GMAC_VLAN_TAG_CTRL_OB),
> +                                1000, timeout);
> +       if (ret) {
> +               netdev_err(dev, "Timeout accessing MAC_VLAN_Tag_Filter\n");
> +               return ret;
> +       }
> +
> +       return 0;
> 

Hi Serge,

Good suggestions! Will send out a new version.

Thanks,
Shenwei

> -Serge(y)
> 
> >
> > --
> > 2.34.1
> >
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ