diff mbox series

[net-next] net: pcs: lynx: fix lynx_pcs_link_up_sgmii() not doing anything in fixed-link mode

Message ID 20230811115352.1447081-1-vladimir.oltean@nxp.com (mailing list archive)
State Accepted
Commit 2f4503f94c5d81d1589842bfb457be466c8c670b
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: pcs: lynx: fix lynx_pcs_link_up_sgmii() not doing anything in fixed-link mode | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1330 this patch: 1330
netdev/cc_maintainers success CCed 10 of 10 maintainers
netdev/build_clang success Errors and warnings before: 1353 this patch: 1353
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1353 this patch: 1353
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Vladimir Oltean Aug. 11, 2023, 11:53 a.m. UTC
lynx_pcs_link_up_sgmii() is supposed to update the PCS speed and duplex
for the non-inband operating modes, and prior to the blamed commit, it
did just that, but a mistake sneaked into the conversion and reversed
the condition.

It is easy for this to go undetected on platforms that also initialize
the PCS in the bootloader, because Linux doesn't reset it (although
maybe it should). The nature of the bug is that phylink will not touch
the IF_MODE_HALF_DUPLEX | IF_MODE_SPEED_MSK fields when it should, and
it will apparently keep working if the previous values set by the
bootloader were correct.

Fixes: c689a6528c22 ("net: pcs: lynx: update PCS driver to use neg_mode")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/pcs/pcs-lynx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Russell King (Oracle) Aug. 11, 2023, 11:55 a.m. UTC | #1
On Fri, Aug 11, 2023 at 02:53:52PM +0300, Vladimir Oltean wrote:
> lynx_pcs_link_up_sgmii() is supposed to update the PCS speed and duplex
> for the non-inband operating modes, and prior to the blamed commit, it
> did just that, but a mistake sneaked into the conversion and reversed
> the condition.

Yes, it certainly looks that way, thanks for catching this.

> It is easy for this to go undetected on platforms that also initialize
> the PCS in the bootloader, because Linux doesn't reset it (although
> maybe it should). The nature of the bug is that phylink will not touch
> the IF_MODE_HALF_DUPLEX | IF_MODE_SPEED_MSK fields when it should, and
> it will apparently keep working if the previous values set by the
> bootloader were correct.
> 
> Fixes: c689a6528c22 ("net: pcs: lynx: update PCS driver to use neg_mode")
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Thanks!
patchwork-bot+netdevbpf@kernel.org Aug. 13, 2023, 11:40 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Fri, 11 Aug 2023 14:53:52 +0300 you wrote:
> lynx_pcs_link_up_sgmii() is supposed to update the PCS speed and duplex
> for the non-inband operating modes, and prior to the blamed commit, it
> did just that, but a mistake sneaked into the conversion and reversed
> the condition.
> 
> It is easy for this to go undetected on platforms that also initialize
> the PCS in the bootloader, because Linux doesn't reset it (although
> maybe it should). The nature of the bug is that phylink will not touch
> the IF_MODE_HALF_DUPLEX | IF_MODE_SPEED_MSK fields when it should, and
> it will apparently keep working if the previous values set by the
> bootloader were correct.
> 
> [...]

Here is the summary with links:
  - [net-next] net: pcs: lynx: fix lynx_pcs_link_up_sgmii() not doing anything in fixed-link mode
    https://git.kernel.org/netdev/net-next/c/2f4503f94c5d

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/pcs/pcs-lynx.c b/drivers/net/pcs/pcs-lynx.c
index 9021b96d4f9d..dc3962b2aa6b 100644
--- a/drivers/net/pcs/pcs-lynx.c
+++ b/drivers/net/pcs/pcs-lynx.c
@@ -216,7 +216,7 @@  static void lynx_pcs_link_up_sgmii(struct mdio_device *pcs,
 	/* The PCS needs to be configured manually only
 	 * when not operating on in-band mode
 	 */
-	if (neg_mode != PHYLINK_PCS_NEG_INBAND_ENABLED)
+	if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED)
 		return;
 
 	if (duplex == DUPLEX_HALF)