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]
Message-ID: <41e96e5e-2184-4ac0-886f-2da18b726783@prolan.hu>
Date: Mon, 12 Feb 2024 16:11:10 +0100
From: Csókás Bence <csokas.bence@...lan.hu>
To: Andrew Lunn <andrew@...n.ch>
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



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).

> So what i'm asking for is obviously correct patches. You can add the
> #defines, and replace (1 << X) with one of the new macros, and it
> should be obvious.

I replaced `#define FEC_ENET_FCE (1 << 5)` with `#define FEC_RCR_FLOWCTL 
         BIT(5)`. I thought that was "obviously correct", but I can 
break the patch up more, if it helps readability.

> However, the change above is not obviously correct, so some
> explanation is required. And it is easier to do that in a patch
> dedicated to this change, with a good explanation.

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?

> 
> 	Andrew
> 

Bence


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ