[openwrt/openwrt] generic: 6.6: net: sfp-bus: fix SFP mode detect from bitrate

LEDE Commits lede-commits at lists.infradead.org
Thu May 30 04:08:05 PDT 2024


dangole pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/a1a9572f43776c3fed46c4545e93fbbb25d923c2

commit a1a9572f43776c3fed46c4545e93fbbb25d923c2
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Thu May 30 12:06:26 2024 +0100

    generic: 6.6: net: sfp-bus: fix SFP mode detect from bitrate
    
    Backport commit fixing detection of SFP modules which has been broken
    since Linux 6.4 for some modules.
    
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 ...-sfp-bus-fix-SFP-mode-detect-from-bitrate.patch | 46 ++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/target/linux/generic/backport-6.6/701-v6.8-net-sfp-bus-fix-SFP-mode-detect-from-bitrate.patch b/target/linux/generic/backport-6.6/701-v6.8-net-sfp-bus-fix-SFP-mode-detect-from-bitrate.patch
new file mode 100644
index 0000000000..83145012b9
--- /dev/null
+++ b/target/linux/generic/backport-6.6/701-v6.8-net-sfp-bus-fix-SFP-mode-detect-from-bitrate.patch
@@ -0,0 +1,46 @@
+From 97eb5d51b4a584a60e5d096bdb6b33edc9f50d8d Mon Sep 17 00:00:00 2001
+From: "Russell King (Oracle)" <rmk+kernel at armlinux.org.uk>
+Date: Mon, 15 Jan 2024 12:43:38 +0000
+Subject: [PATCH] net: sfp-bus: fix SFP mode detect from bitrate
+
+The referenced commit moved the setting of the Autoneg and pause bits
+early in sfp_parse_support(). However, we check whether the modes are
+empty before using the bitrate to set some modes. Setting these bits
+so early causes that test to always be false, preventing this working,
+and thus some modules that used to work no longer do.
+
+Move them just before the call to the quirk.
+
+Fixes: 8110633db49d ("net: sfp-bus: allow SFP quirks to override Autoneg and pause bits")
+Signed-off-by: Russell King (Oracle) <rmk+kernel at armlinux.org.uk>
+Reviewed-by: Maxime Chevallier <maxime.chevallier at bootlin.com>
+Link: https://lore.kernel.org/r/E1rPMJW-001Ahf-L0@rmk-PC.armlinux.org.uk
+Signed-off-by: Jakub Kicinski <kuba at kernel.org>
+---
+ drivers/net/phy/sfp-bus.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/drivers/net/phy/sfp-bus.c
++++ b/drivers/net/phy/sfp-bus.c
+@@ -151,10 +151,6 @@ void sfp_parse_support(struct sfp_bus *b
+ 	unsigned int br_min, br_nom, br_max;
+ 	__ETHTOOL_DECLARE_LINK_MODE_MASK(modes) = { 0, };
+ 
+-	phylink_set(modes, Autoneg);
+-	phylink_set(modes, Pause);
+-	phylink_set(modes, Asym_Pause);
+-
+ 	/* Decode the bitrate information to MBd */
+ 	br_min = br_nom = br_max = 0;
+ 	if (id->base.br_nominal) {
+@@ -339,6 +335,10 @@ void sfp_parse_support(struct sfp_bus *b
+ 		}
+ 	}
+ 
++	phylink_set(modes, Autoneg);
++	phylink_set(modes, Pause);
++	phylink_set(modes, Asym_Pause);
++
+ 	if (bus->sfp_quirk && bus->sfp_quirk->modes)
+ 		bus->sfp_quirk->modes(id, modes, interfaces);
+ 




More information about the lede-commits mailing list