Skip to contentSkip to conversation

net: sfp: Add tx-fault quirk for Huawei MA5671A SFP ONT

PATCH Superseded Matthew Hagan 2 participants 3 messages Apr 30, 2022 – May 2, 2022

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: sfp: Add tx-fault quirk for Huawei MA5671A SFP ONT

As noted elsewhere [1], various GPON SFP modules exhibit non-standard TX-fault behaviour. In the tested case, the Huawei MA5671A, when used in combination with a Marvell 88E6393X switch, was found to persistently assert TX-fault, resulting in the module being disabled.

This patch adds a quirk to ignore changes to the the SFP_F_TX_FAULT state, thus allowing the module to function.

[1] https://lore.kernel.org/all/[email protected]/

---
 drivers/net/phy/sfp.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/net/phy/sfp.c +13 -1
index 4dfb79807823..11a20687b273 100644
@@ -250,6 +250,7 @@ struct sfp {
 	struct sfp_eeprom_id id;
 	unsigned int module_power_mW;
 	unsigned int module_t_start_up;
+	bool tx_fault_ignore;
 
 #if IS_ENABLED(CONFIG_HWMON)
 	struct sfp_diag diag;
@@ -1956,6 +1957,14 @@ static int sfp_sm_mod_probe(struct sfp *sfp, bool report)
 	else
 		sfp->module_t_start_up = T_START_UP;
 
+	if (!memcmp(id.base.vendor_name, "HUAWEI          ", 16) &&
+	    !memcmp(id.base.vendor_pn, "MA5671A         ", 16))
+		sfp->tx_fault_ignore = true;
+	else
+		sfp->tx_fault_ignore = false;
+
+	return 0;
+
 	return 0;
 }
 
@@ -2409,7 +2418,10 @@ static void sfp_check_state(struct sfp *sfp)
 	mutex_lock(&sfp->st_mutex);
 	state = sfp_get_state(sfp);
 	changed = state ^ sfp->state;
-	changed &= SFP_F_PRESENT | SFP_F_LOS | SFP_F_TX_FAULT;
+	if (sfp->tx_fault_ignore)
+		changed &= SFP_F_PRESENT | SFP_F_LOS;
+	else
+		changed &= SFP_F_PRESENT | SFP_F_LOS | SFP_F_TX_FAULT;
 
 	for (i = 0; i < GPIO_MAX; i++)
 		if (changed & BIT(i))
Signature · 1 line
2.27.0
maintainer
#1 lore raw

drivers/net/phy/sfp.c static int sfp_sm_mod_probe(struct sfp *sfp, bool report) · line 1968

Quoted 9 lines
drivers/net/phy/sfp.c +8 -0
+	if (!memcmp(id.base.vendor_name, "HUAWEI          ", 16) &&
+	    !memcmp(id.base.vendor_pn, "MA5671A         ", 16))
+		sfp->tx_fault_ignore = true;
+	else
+		sfp->tx_fault_ignore = false;
+
+	return 0;
+
 	return 0;

Why do we need two return 0; Probably a merged conflict gone wrong.

Andrew

#2 lore raw
Quoted 13 lines · Andrew Lunn

drivers/net/phy/sfp.c static int sfp_sm_mod_probe(struct sfp *sfp, bool report) · line 1968

Quoted 10 lines
drivers/net/phy/sfp.c +8 -0
+     if (!memcmp(id.base.vendor_name, "HUAWEI          ", 16) &&
+         !memcmp(id.base.vendor_pn, "MA5671A         ", 16))
+             sfp->tx_fault_ignore = true;
+     else
+             sfp->tx_fault_ignore = false;
+
+     return 0;
+
      return 0;

Why do we need two return 0; Probably a merged conflict gone wrong.

Apologies for the oversight. Will submit a v2 shortly.

Quoted 1 line

Andrew

Matthew