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] [thread-next>] [day] [month] [year] [list]
Date: Mon, 12 Feb 2024 17:03:04 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Csókás Bence <csokas.bence@...lan.hu>
Cc: netdev@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
	"David S. Miller" <davem@...emloft.net>,
	Wei Fang <wei.fang@....com>, Shenwei Wang <shenwei.wang@....com>,
	Clark Wang <xiaoning.wang@....com>,
	NXP Linux Team <linux-imx@....com>,
	Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
	Francesco Dolcini <francesco.dolcini@...adex.com>,
	Marc Kleine-Budde <mkl@...gutronix.de>
Subject: Re: [PATCH v2] net: fec: Refactor: #define magic constants

On Mon, Feb 12, 2024 at 04:11:10PM +0100, Csókás Bence wrote:
> 
> 
> 2024. 02. 12. 16:04 keltezéssel, Andrew Lunn írta:
> > On Mon, Feb 12, 2024 at 03:49:42PM +0100, Csókás Bence wrote:
> > > Hi!
> > > 
> > > 2024. 02. 09. 14:53 keltezéssel, Andrew Lunn írta:
> > > > > @@ -1181,7 +1194,7 @@ fec_restart(struct net_device *ndev)
> > > > >    	if ((fep->pause_flag & FEC_PAUSE_FLAG_ENABLE) ||
> > > > >    	    ((fep->pause_flag & FEC_PAUSE_FLAG_AUTONEG) &&
> > > > >    	     ndev->phydev && ndev->phydev->pause)) {
> > > > > -		rcntl |= FEC_ENET_FCE;
> > > > > +		rcntl |= FEC_RCR_FLOWCTL;
> > > > 
> > > > This immediately stood out to me while looking at the diff. Its not
> > > > obvious why this is correct. Looking back, i see you removed
> > > > FEC_ENET_FCE, not renamed it.
> > > 
> > > What do you mean? I replaced FEC_ENET_FCE with FEC_RCR_FLOWCTL, to make it
> > > obvious that it represents a bit in RCR (or `rcntl` as it is called on this
> > > line). How is that not "renaming" it?
> > 
> > Going from FEC_NET_ to FEC_RCR_ in itself makes me ask questions. Was
> > it wrong before? Is this actually a fix? Is it correct now, or is this
> > a cut/paste typo? Looking at the rest of the patch there is no obvious
> > answer. As i said, you deleted FEC_ENET_FCE, but there is no
> > explanation why.
> 
> The name `FEC_ENET_FCE` does not tell us that this is the FCE (Flow Control
> Enable) bit (1 << 5) of the RCR (Receive Control Register). I added
> FEC_RCR_* macros for all RCR bits, and I named BIT(5) FEC_RCR_FLOWCTL, a
> much more descriptive name (in my opinion, at least).

Some form of that would be good in the commit message. It explains the
'Why?' of the change.

> So, a separate patch just for removing FEC_ENET_FCE and replacing all usages
> with FEC_RCR_FLOWCTL? And the rest can stay as-is?

A few others made review comments as well. It could be addressing
those comments also requires more small patches. Sometimes you can
avoid review comments by thinking, what are reviewers going to ask,
and putting the answer to those questions in the commit message. This
might all seam like a lot of hassle now, but it will help getting your
future patchsets merged if you follow this advice.

      Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ