netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Csókás Bence" <csokas.bence@prolan.hu>
To: Andrew Lunn <andrew@lunn.ch>
Cc: <netdev@vger.kernel.org>, Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Wei Fang <wei.fang@nxp.com>, Shenwei Wang <shenwei.wang@nxp.com>,
	Clark Wang <xiaoning.wang@nxp.com>,
	NXP Linux Team <linux-imx@nxp.com>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Francesco Dolcini <francesco.dolcini@toradex.com>,
	"Marc Kleine-Budde" <mkl@pengutronix.de>
Subject: Re: [PATCH v2] net: fec: Refactor: #define magic constants
Date: Mon, 12 Feb 2024 16:11:10 +0100	[thread overview]
Message-ID: <41e96e5e-2184-4ac0-886f-2da18b726783@prolan.hu> (raw)
In-Reply-To: <cfc31be3-935d-432f-aa7a-38976c7ca954@lunn.ch>



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


  reply	other threads:[~2024-02-12 15:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-09  9:11 [PATCH v2] net: fec: Refactor: #define magic constants Csókás Bence
2024-02-09  9:17 ` Marc Kleine-Budde
2024-02-09  9:39 ` Denis Kirjanov
2024-02-09 13:53 ` Andrew Lunn
2024-02-12 14:49   ` Csókás Bence
2024-02-12 15:04     ` Andrew Lunn
2024-02-12 15:11       ` Csókás Bence [this message]
2024-02-12 16:03         ` Andrew Lunn
2024-02-12 16:34           ` Csókás Bence

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41e96e5e-2184-4ac0-886f-2da18b726783@prolan.hu \
    --to=csokas.bence@prolan.hu \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=francesco.dolcini@toradex.com \
    --cc=kuba@kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shenwei.wang@nxp.com \
    --cc=wei.fang@nxp.com \
    --cc=xiaoning.wang@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).