linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 net 0/2] ocelot phylink fixes
@ 2021-09-17 15:39 Colin Foster
  2021-09-17 15:39 ` [PATCH v3 net 1/2] net: mscc: ocelot: remove buggy and useless write to ANA_PFC_PFC_CFG Colin Foster
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Colin Foster @ 2021-09-17 15:39 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: Vladimir Oltean, Claudiu Manoil, Alexandre Belloni,
	UNGLinuxDriver, David S. Miller, Jakub Kicinski

When the ocelot driver was migrated to phylink, e6e12df625f2 ("net: 
mscc: ocelot: convert to phylink") there were two additional writes to
registers that became stale. One write was to DEV_CLOCK_CFG and one was
to ANA_PFC_PCF_CFG.

Both of these writes referenced the variable "speed" which originally
was set to OCELOT_SPEED_{10,100,1000,2500}. These macros expand to
values of 3, 2, 1, or 0, respectively. After the update, the variable
speed is set to SPEED_{10,100,1000,2500} which expand to 10, 100, 1000,
and 2500. So invalid values were getting written to the two registers,
which would lead to either a lack of functionality or undefined
funcationality.

Fixing these values was the intent of v1 of this patch set - submitted
as "[PATCH v1 net] net: ethernet: mscc: ocelot: bug fix when writing MAC
speed"

During that review it was determined that both writes were actually
unnecessary. DEV_CLOCK_CFG is a duplicate write, so can be removed
entirely. This was accidentally submitted as as a new, lone patch titled 
"[PATCH v1 net] net: mscc: ocelot: remove buggy duplicate write to 
DEV_CLOCK_CFG". This is part of what is considered v2 of this patch set.

Additionally, the write to ANA_PFC_PFC_CFG is also unnecessary. Priority
flow contol is disabled, so configuring it is useless and should be
removed. This was also submitted as a new, lone patch titled "[PATCH v1 
net] net: mscc: ocelot: remove buggy and useless write to ANA_PFC_PFC_CFG".
This is the rest of what is considered v2 of this patch set.


v3
Identical to v2, but fixes the patch numbering to v3 and submitting the
two changes as a patch set.

v2
Note: I misunderstood and submitted two new "v1" patches instead of a
single "v2" patch set.
- Remove the buggy writes altogher


Colin Foster (2):
  net: mscc: ocelot: remove buggy and useless write to ANA_PFC_PFC_CFG
  net: mscc: ocelot: remove buggy duplicate write to DEV_CLOCK_CFG

 drivers/net/ethernet/mscc/ocelot.c | 10 ----------
 1 file changed, 10 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 net 1/2] net: mscc: ocelot: remove buggy and useless write to ANA_PFC_PFC_CFG
  2021-09-17 15:39 [PATCH v3 net 0/2] ocelot phylink fixes Colin Foster
@ 2021-09-17 15:39 ` Colin Foster
  2021-09-17 15:39 ` [PATCH v3 net 2/2] net: mscc: ocelot: remove buggy duplicate write to DEV_CLOCK_CFG Colin Foster
  2021-09-19 12:10 ` [PATCH v3 net 0/2] ocelot phylink fixes patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Colin Foster @ 2021-09-17 15:39 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: Vladimir Oltean, Claudiu Manoil, Alexandre Belloni,
	UNGLinuxDriver, David S. Miller, Jakub Kicinski

A useless write to ANA_PFC_PFC_CFG was left in while refactoring ocelot to
phylink. Since priority flow control is disabled, writing the speed has no
effect.

Further, it was using ethtool.h SPEED_ instead of OCELOT_SPEED_ macros,
which are incorrectly offset for GENMASK.

Lastly, for priority flow control to properly function, some scenarios
would rely on the rate adaptation from the PCS while the MAC speed would
be fixed. So it isn't used, and even if it was, neither "speed" nor
"mac_speed" are necessarily the correct values to be used.

Fixes: e6e12df625f2 ("net: mscc: ocelot: convert to phylink")
Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/ethernet/mscc/ocelot.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
index c581b955efb3..08be0440af28 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -569,10 +569,6 @@ void ocelot_phylink_mac_link_up(struct ocelot *ocelot, int port,
 	ocelot_port_writel(ocelot_port, DEV_CLOCK_CFG_LINK_SPEED(speed),
 			   DEV_CLOCK_CFG);
 
-	/* No PFC */
-	ocelot_write_gix(ocelot, ANA_PFC_PFC_CFG_FC_LINK_SPEED(speed),
-			 ANA_PFC_PFC_CFG, port);
-
 	/* Core: Enable port for frame transfer */
 	ocelot_fields_write(ocelot, port,
 			    QSYS_SWITCH_PORT_MODE_PORT_ENA, 1);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3 net 2/2] net: mscc: ocelot: remove buggy duplicate write to DEV_CLOCK_CFG
  2021-09-17 15:39 [PATCH v3 net 0/2] ocelot phylink fixes Colin Foster
  2021-09-17 15:39 ` [PATCH v3 net 1/2] net: mscc: ocelot: remove buggy and useless write to ANA_PFC_PFC_CFG Colin Foster
@ 2021-09-17 15:39 ` Colin Foster
  2021-09-19 12:10 ` [PATCH v3 net 0/2] ocelot phylink fixes patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Colin Foster @ 2021-09-17 15:39 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: Vladimir Oltean, Claudiu Manoil, Alexandre Belloni,
	UNGLinuxDriver, David S. Miller, Jakub Kicinski

When updating ocelot to use phylink, a second write to DEV_CLOCK_CFG was
mistakenly left in. It used the variable "speed" which, previously, would
would have been assigned a value of OCELOT_SPEED_1000. In phylink the
variable is be SPEED_1000, which is invalid for the
DEV_CLOCK_LINK_SPEED macro. Removing it as unnecessary and buggy.

Fixes: e6e12df625f2 ("net: mscc: ocelot: convert to phylink")
Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/ethernet/mscc/ocelot.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
index 08be0440af28..729ba826ba17 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -563,12 +563,6 @@ void ocelot_phylink_mac_link_up(struct ocelot *ocelot, int port,
 	ocelot_port_writel(ocelot_port, DEV_MAC_ENA_CFG_RX_ENA |
 			   DEV_MAC_ENA_CFG_TX_ENA, DEV_MAC_ENA_CFG);
 
-	/* Take MAC, Port, Phy (intern) and PCS (SGMII/Serdes) clock out of
-	 * reset
-	 */
-	ocelot_port_writel(ocelot_port, DEV_CLOCK_CFG_LINK_SPEED(speed),
-			   DEV_CLOCK_CFG);
-
 	/* Core: Enable port for frame transfer */
 	ocelot_fields_write(ocelot, port,
 			    QSYS_SWITCH_PORT_MODE_PORT_ENA, 1);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 net 0/2] ocelot phylink fixes
  2021-09-17 15:39 [PATCH v3 net 0/2] ocelot phylink fixes Colin Foster
  2021-09-17 15:39 ` [PATCH v3 net 1/2] net: mscc: ocelot: remove buggy and useless write to ANA_PFC_PFC_CFG Colin Foster
  2021-09-17 15:39 ` [PATCH v3 net 2/2] net: mscc: ocelot: remove buggy duplicate write to DEV_CLOCK_CFG Colin Foster
@ 2021-09-19 12:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-09-19 12:10 UTC (permalink / raw)
  To: Colin Foster
  Cc: netdev, linux-kernel, vladimir.oltean, claudiu.manoil,
	alexandre.belloni, UNGLinuxDriver, davem, kuba

Hello:

This series was applied to netdev/net.git (refs/heads/master):

On Fri, 17 Sep 2021 08:39:03 -0700 you wrote:
> When the ocelot driver was migrated to phylink, e6e12df625f2 ("net:
> mscc: ocelot: convert to phylink") there were two additional writes to
> registers that became stale. One write was to DEV_CLOCK_CFG and one was
> to ANA_PFC_PCF_CFG.
> 
> Both of these writes referenced the variable "speed" which originally
> was set to OCELOT_SPEED_{10,100,1000,2500}. These macros expand to
> values of 3, 2, 1, or 0, respectively. After the update, the variable
> speed is set to SPEED_{10,100,1000,2500} which expand to 10, 100, 1000,
> and 2500. So invalid values were getting written to the two registers,
> which would lead to either a lack of functionality or undefined
> funcationality.
> 
> [...]

Here is the summary with links:
  - [v3,net,1/2] net: mscc: ocelot: remove buggy and useless write to ANA_PFC_PFC_CFG
    https://git.kernel.org/netdev/net/c/163957c43d96
  - [v3,net,2/2] net: mscc: ocelot: remove buggy duplicate write to DEV_CLOCK_CFG
    https://git.kernel.org/netdev/net/c/ba68e9941984

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-19 12:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-17 15:39 [PATCH v3 net 0/2] ocelot phylink fixes Colin Foster
2021-09-17 15:39 ` [PATCH v3 net 1/2] net: mscc: ocelot: remove buggy and useless write to ANA_PFC_PFC_CFG Colin Foster
2021-09-17 15:39 ` [PATCH v3 net 2/2] net: mscc: ocelot: remove buggy duplicate write to DEV_CLOCK_CFG Colin Foster
2021-09-19 12:10 ` [PATCH v3 net 0/2] ocelot phylink fixes patchwork-bot+netdevbpf

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