[openwrt/openwrt] generic: replace SFP ignore TX FAULT with upstream version
LEDE Commits
lede-commits at lists.infradead.org
Mon Apr 14 01:29:02 PDT 2025
ansuel pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/ff802ccc44d39244de1e13933473269c20b0a667
commit ff802ccc44d39244de1e13933473269c20b0a667
Author: Christian Marangi <ansuelsmth at gmail.com>
AuthorDate: Sat Apr 12 00:58:19 2025 +0200
generic: replace SFP ignore TX FAULT with upstream version
Replace SFP ignore TX FAULT with upstream version by backporting the 2
related upstream patch. Refresh SFP affected patch.
Link: https://github.com/openwrt/openwrt/pull/18464
Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
---
...implement-ignoring-the-hardware-TX_FAULT-.patch | 85 ++++++++++++++++++++++
...-quirk-for-ATS-SFP-GE-T-1000Base-TX-modul.patch | 35 +++++++++
...-sfp-rework-the-RollBall-PHY-waiting-code.patch | 12 +--
...fix-PHY-discovery-for-FS-SFP-10G-T-module.patch | 10 +--
.../hack-6.6/790-SFP-GE-T-ignore-TX_FAULT.patch | 63 ----------------
5 files changed, 131 insertions(+), 74 deletions(-)
diff --git a/target/linux/generic/backport-6.6/730-v6.7-net-sfp-re-implement-ignoring-the-hardware-TX_FAULT-.patch b/target/linux/generic/backport-6.6/730-v6.7-net-sfp-re-implement-ignoring-the-hardware-TX_FAULT-.patch
new file mode 100644
index 0000000000..9cb491b2d8
--- /dev/null
+++ b/target/linux/generic/backport-6.6/730-v6.7-net-sfp-re-implement-ignoring-the-hardware-TX_FAULT-.patch
@@ -0,0 +1,85 @@
+From e184e8609f8c1cd9fef703f667245b6ebd89c2ed Mon Sep 17 00:00:00 2001
+From: "Russell King (Oracle)" <rmk+kernel at armlinux.org.uk>
+Date: Tue, 3 Oct 2023 14:34:24 +0100
+Subject: [PATCH] net: sfp: re-implement ignoring the hardware TX_FAULT signal
+
+Re-implement how we ignore the hardware TX_FAULT signal. Rather than
+having a separate boolean for this, use a bitmask of the hardware
+signals that we wish to ignore. This gives more flexibility in the
+future to ignore other signals such as RX_LOS.
+
+Signed-off-by: Russell King (Oracle) <rmk+kernel at armlinux.org.uk>
+Tested-by: Christian Marangi <ansuelsmth at gmail.com>
+Link: https://lore.kernel.org/r/E1qnfXc-008UDY-91@rmk-PC.armlinux.org.uk
+Signed-off-by: Jakub Kicinski <kuba at kernel.org>
+---
+ drivers/net/phy/sfp.c | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+--- a/drivers/net/phy/sfp.c
++++ b/drivers/net/phy/sfp.c
+@@ -257,6 +257,7 @@ struct sfp {
+ unsigned int state_hw_drive;
+ unsigned int state_hw_mask;
+ unsigned int state_soft_mask;
++ unsigned int state_ignore_mask;
+ unsigned int state;
+
+ struct delayed_work poll;
+@@ -280,7 +281,6 @@ struct sfp {
+ unsigned int rs_state_mask;
+
+ bool have_a2;
+- bool tx_fault_ignore;
+
+ const struct sfp_quirk *quirk;
+
+@@ -347,7 +347,7 @@ static void sfp_fixup_long_startup(struc
+
+ static void sfp_fixup_ignore_tx_fault(struct sfp *sfp)
+ {
+- sfp->tx_fault_ignore = true;
++ sfp->state_ignore_mask |= SFP_F_TX_FAULT;
+ }
+
+ // For 10GBASE-T short-reach modules
+@@ -796,7 +796,8 @@ static void sfp_soft_start_poll(struct s
+
+ mutex_lock(&sfp->st_mutex);
+ // Poll the soft state for hardware pins we want to ignore
+- sfp->state_soft_mask = ~sfp->state_hw_mask & mask;
++ sfp->state_soft_mask = ~sfp->state_hw_mask & ~sfp->state_ignore_mask &
++ mask;
+
+ if (sfp->state_soft_mask & (SFP_F_LOS | SFP_F_TX_FAULT) &&
+ !sfp->need_poll)
+@@ -2321,7 +2322,7 @@ static int sfp_sm_mod_probe(struct sfp *
+ sfp->module_t_start_up = T_START_UP;
+ sfp->module_t_wait = T_WAIT;
+
+- sfp->tx_fault_ignore = false;
++ sfp->state_ignore_mask = 0;
+
+ if (sfp->id.base.extended_cc == SFF8024_ECC_10GBASE_T_SFI ||
+ sfp->id.base.extended_cc == SFF8024_ECC_10GBASE_T_SR ||
+@@ -2344,6 +2345,8 @@ static int sfp_sm_mod_probe(struct sfp *
+
+ if (sfp->quirk && sfp->quirk->fixup)
+ sfp->quirk->fixup(sfp);
++
++ sfp->state_hw_mask &= ~sfp->state_ignore_mask;
+ mutex_unlock(&sfp->st_mutex);
+
+ return 0;
+@@ -2844,10 +2847,7 @@ static void sfp_check_state(struct sfp *
+ mutex_lock(&sfp->st_mutex);
+ state = sfp_get_state(sfp);
+ changed = state ^ sfp->state;
+- if (sfp->tx_fault_ignore)
+- changed &= SFP_F_PRESENT | SFP_F_LOS;
+- else
+- changed &= SFP_F_PRESENT | SFP_F_LOS | SFP_F_TX_FAULT;
++ changed &= SFP_F_PRESENT | SFP_F_LOS | SFP_F_TX_FAULT;
+
+ for (i = 0; i < GPIO_MAX; i++)
+ if (changed & BIT(i))
diff --git a/target/linux/generic/backport-6.6/731-v6.10-net-sfp-add-quirk-for-ATS-SFP-GE-T-1000Base-TX-modul.patch b/target/linux/generic/backport-6.6/731-v6.10-net-sfp-add-quirk-for-ATS-SFP-GE-T-1000Base-TX-modul.patch
new file mode 100644
index 0000000000..c006c8a045
--- /dev/null
+++ b/target/linux/generic/backport-6.6/731-v6.10-net-sfp-add-quirk-for-ATS-SFP-GE-T-1000Base-TX-modul.patch
@@ -0,0 +1,35 @@
+From 0805d67bc0ef95411228e802f31975cfb7555056 Mon Sep 17 00:00:00 2001
+From: Daniel Golle <daniel at makrotopia.org>
+Date: Tue, 23 Apr 2024 11:00:25 +0200
+Subject: [PATCH] net: sfp: add quirk for ATS SFP-GE-T 1000Base-TX module
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Add quirk for ATS SFP-GE-T 1000Base-TX module.
+
+This copper module comes with broken TX_FAULT indicator which must be
+ignored for it to work.
+
+Co-authored-by: Josef Schlehofer <pepe.schlehofer at gmail.com>
+Signed-off-by: Daniel Golle <daniel at makrotopia.org>
+[ rebased on top of net-next ]
+Signed-off-by: Marek Behún <kabel at kernel.org>
+Link: https://lore.kernel.org/r/20240423090025.29231-1-kabel@kernel.org
+Signed-off-by: Jakub Kicinski <kuba at kernel.org>
+---
+ drivers/net/phy/sfp.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/net/phy/sfp.c
++++ b/drivers/net/phy/sfp.c
+@@ -486,6 +486,9 @@ static const struct sfp_quirk sfp_quirks
+ // OEM SFP-GE-T is a 1000Base-T module with broken TX_FAULT indicator
+ SFP_QUIRK_F("OEM", "SFP-GE-T", sfp_fixup_ignore_tx_fault),
+
++ // OEM SFP-GE-T is a 1000Base-T module with broken TX_FAULT indicator
++ SFP_QUIRK_F("OEM", "SFP-GE-T", sfp_fixup_ignore_tx_fault),
++
+ SFP_QUIRK_F("OEM", "SFP-10G-T", sfp_fixup_rollball_cc),
+ SFP_QUIRK_M("OEM", "SFP-2.5G-T", sfp_quirk_oem_2_5g),
+ SFP_QUIRK_F("OEM", "RTSFP-10", sfp_fixup_rollball_cc),
diff --git a/target/linux/generic/backport-6.6/785-01-v6.8-net-sfp-rework-the-RollBall-PHY-waiting-code.patch b/target/linux/generic/backport-6.6/785-01-v6.8-net-sfp-rework-the-RollBall-PHY-waiting-code.patch
index c1721b3b13..31b2c41d3a 100644
--- a/target/linux/generic/backport-6.6/785-01-v6.8-net-sfp-rework-the-RollBall-PHY-waiting-code.patch
+++ b/target/linux/generic/backport-6.6/785-01-v6.8-net-sfp-rework-the-RollBall-PHY-waiting-code.patch
@@ -36,7 +36,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
/* SFP module presence detection is poor: the three MOD DEF signals are
* the same length on the PCB, which means it's possible for MOD DEF 0 to
-@@ -273,7 +273,7 @@ struct sfp {
+@@ -274,7 +274,7 @@ struct sfp {
struct sfp_eeprom_id id;
unsigned int module_power_mW;
unsigned int module_t_start_up;
@@ -86,16 +86,16 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
static void sfp_fixup_rollball_cc(struct sfp *sfp)
{
sfp_fixup_rollball(sfp);
-@@ -2319,7 +2317,7 @@ static int sfp_sm_mod_probe(struct sfp *
+@@ -2323,7 +2321,7 @@ static int sfp_sm_mod_probe(struct sfp *
mask |= SFP_F_RS1;
sfp->module_t_start_up = T_START_UP;
- sfp->module_t_wait = T_WAIT;
+ sfp->phy_t_retry = T_PHY_RETRY;
- sfp->tx_fault_ignore = false;
+ sfp->state_ignore_mask = 0;
-@@ -2553,10 +2551,9 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -2559,10 +2557,9 @@ static void sfp_sm_main(struct sfp *sfp,
/* We need to check the TX_FAULT state, which is not defined
* while TX_DISABLE is asserted. The earliest we want to do
@@ -108,7 +108,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
break;
case SFP_S_WAIT:
-@@ -2570,8 +2567,8 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -2576,8 +2573,8 @@ static void sfp_sm_main(struct sfp *sfp,
* deasserting.
*/
timeout = sfp->module_t_start_up;
@@ -119,7 +119,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
else
timeout = 1;
-@@ -2614,7 +2611,11 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -2620,7 +2617,11 @@ static void sfp_sm_main(struct sfp *sfp,
ret = sfp_sm_probe_for_phy(sfp);
if (ret == -ENODEV) {
if (--sfp->sm_phy_retries) {
diff --git a/target/linux/generic/backport-6.6/785-02-v6.8-net-sfp-fix-PHY-discovery-for-FS-SFP-10G-T-module.patch b/target/linux/generic/backport-6.6/785-02-v6.8-net-sfp-fix-PHY-discovery-for-FS-SFP-10G-T-module.patch
index 234e5a1e44..998579c462 100644
--- a/target/linux/generic/backport-6.6/785-02-v6.8-net-sfp-fix-PHY-discovery-for-FS-SFP-10G-T-module.patch
+++ b/target/linux/generic/backport-6.6/785-02-v6.8-net-sfp-fix-PHY-discovery-for-FS-SFP-10G-T-module.patch
@@ -30,7 +30,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
-@@ -273,6 +273,7 @@ struct sfp {
+@@ -274,6 +274,7 @@ struct sfp {
struct sfp_eeprom_id id;
unsigned int module_power_mW;
unsigned int module_t_start_up;
@@ -51,15 +51,15 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
}
static void sfp_fixup_halny_gsfp(struct sfp *sfp)
-@@ -2317,6 +2324,7 @@ static int sfp_sm_mod_probe(struct sfp *
+@@ -2321,6 +2328,7 @@ static int sfp_sm_mod_probe(struct sfp *
mask |= SFP_F_RS1;
sfp->module_t_start_up = T_START_UP;
+ sfp->module_t_wait = T_WAIT;
sfp->phy_t_retry = T_PHY_RETRY;
- sfp->tx_fault_ignore = false;
-@@ -2551,9 +2559,10 @@ static void sfp_sm_main(struct sfp *sfp,
+ sfp->state_ignore_mask = 0;
+@@ -2557,9 +2565,10 @@ static void sfp_sm_main(struct sfp *sfp,
/* We need to check the TX_FAULT state, which is not defined
* while TX_DISABLE is asserted. The earliest we want to do
@@ -72,7 +72,7 @@ Signed-off-by: David S. Miller <davem at davemloft.net>
break;
case SFP_S_WAIT:
-@@ -2567,8 +2576,8 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -2573,8 +2582,8 @@ static void sfp_sm_main(struct sfp *sfp,
* deasserting.
*/
timeout = sfp->module_t_start_up;
diff --git a/target/linux/generic/hack-6.6/790-SFP-GE-T-ignore-TX_FAULT.patch b/target/linux/generic/hack-6.6/790-SFP-GE-T-ignore-TX_FAULT.patch
deleted file mode 100644
index b125e93aaf..0000000000
--- a/target/linux/generic/hack-6.6/790-SFP-GE-T-ignore-TX_FAULT.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-From 7cc39a6bedbd85f3ff7e16845f310e4ce8d9833f Mon Sep 17 00:00:00 2001
-From: Daniel Golle <daniel at makrotopia.org>
-Date: Tue, 6 Sep 2022 00:31:19 +0100
-Subject: [PATCH] net: sfp: add quirk for ATS SFP-GE-T 1000Base-TX module
-To: netdev at vger.kernel.org,
- linux-kernel at vger.kernel.org,
- Russell King <linux at armlinux.org.uk>,
- Andrew Lunn <andrew at lunn.ch>,
- Heiner Kallweit <hkallweit1 at gmail.com>
-Cc: David S. Miller <davem at davemloft.net>,
- Eric Dumazet <edumazet at google.com>,
- Jakub Kicinski <kuba at kernel.org>,
- Paolo Abeni <pabeni at redhat.com>,
- Josef Schlehofer <pepe.schlehofer at gmail.com>
-
-This copper module comes with broken TX_FAULT indicator which must be
-ignored for it to work. Implement ignoring TX_FAULT state bit also
-during reset/insertion and mute the warning telling the user that the
-module indicates TX_FAULT.
-
-Co-authored-by: Josef Schlehofer <pepe.schlehofer at gmail.com>
-Signed-off-by: Daniel Golle <daniel at makrotopia.org>
----
- drivers/net/phy/sfp.c | 14 +++++++++++---
- 1 file changed, 11 insertions(+), 3 deletions(-)
-
---- a/drivers/net/phy/sfp.c
-+++ b/drivers/net/phy/sfp.c
-@@ -485,6 +485,9 @@ static const struct sfp_quirk sfp_quirks
- SFP_QUIRK("HUAWEI", "MA5671A", sfp_quirk_2500basex,
- sfp_fixup_ignore_tx_fault),
-
-+ // OEM SFP-GE-T is 1000Base-T module
-+ SFP_QUIRK_F("OEM", "SFP-GE-T", sfp_fixup_ignore_tx_fault),
-+
- // Lantech 8330-262D-E can operate at 2500base-X, but incorrectly report
- // 2500MBd NRZ in their EEPROM
- SFP_QUIRK_M("Lantech", "8330-262D-E", sfp_quirk_2500basex),
-@@ -2604,7 +2607,8 @@ static void sfp_sm_main(struct sfp *sfp,
- * or t_start_up, so assume there is a fault.
- */
- sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT,
-- sfp->sm_fault_retries == N_FAULT_INIT);
-+ !sfp->tx_fault_ignore &&
-+ (sfp->sm_fault_retries == N_FAULT_INIT));
- } else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) {
- init_done:
- /* Create mdiobus and start trying for PHY */
-@@ -2862,10 +2866,12 @@ static void sfp_check_state(struct sfp *
- mutex_lock(&sfp->st_mutex);
- state = sfp_get_state(sfp);
- changed = state ^ sfp->state;
-- if (sfp->tx_fault_ignore)
-+ if (sfp->tx_fault_ignore) {
- changed &= SFP_F_PRESENT | SFP_F_LOS;
-- else
-+ state &= ~SFP_F_TX_FAULT;
-+ } else {
- changed &= SFP_F_PRESENT | SFP_F_LOS | SFP_F_TX_FAULT;
-+ }
-
- for (i = 0; i < GPIO_MAX; i++)
- if (changed & BIT(i))
More information about the lede-commits
mailing list