* [PATCH v2] net: sfp: Add tx-fault workaround for Huawei MA5671A SFP ONT
@ 2022-05-02 22:33 Matthew Hagan
2022-05-03 22:18 ` Andrew Lunn
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Matthew Hagan @ 2022-05-02 22:33 UTC (permalink / raw)
Cc: Matthew Hagan, Russell King, Andrew Lunn, Heiner Kallweit,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev, linux-kernel
As noted elsewhere, various GPON SFP modules exhibit non-standard
TX-fault behaviour. In the tested case, the Huawei MA5671A, when used
in combination with a Marvell mv88e6085 switch, was found to
persistently assert TX-fault, resulting in the module being disabled.
This patch adds a quirk to ignore the SFP_F_TX_FAULT state, allowing the
module to function.
Change from v1: removal of erroneous return statment (Andrew Lunn)
Signed-off-by: Matthew Hagan <mnhagan88@gmail.com>
---
drivers/net/phy/sfp.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index 4dfb79807823..9a5d5a10560f 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -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,12 @@ 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;
}
@@ -2409,7 +2416,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))
--
2.27.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] net: sfp: Add tx-fault workaround for Huawei MA5671A SFP ONT
2022-05-02 22:33 [PATCH v2] net: sfp: Add tx-fault workaround for Huawei MA5671A SFP ONT Matthew Hagan
@ 2022-05-03 22:18 ` Andrew Lunn
2022-05-04 0:00 ` patchwork-bot+netdevbpf
[not found] ` <20220508161712.wgzrq3wigaa7kobh@pali>
2 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2022-05-03 22:18 UTC (permalink / raw)
To: Matthew Hagan
Cc: Russell King, Heiner Kallweit, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
On Mon, May 02, 2022 at 11:33:15PM +0100, Matthew Hagan wrote:
> As noted elsewhere, various GPON SFP modules exhibit non-standard
> TX-fault behaviour. In the tested case, the Huawei MA5671A, when used
> in combination with a Marvell mv88e6085 switch, was found to
> persistently assert TX-fault, resulting in the module being disabled.
>
> This patch adds a quirk to ignore the SFP_F_TX_FAULT state, allowing the
> module to function.
>
> Change from v1: removal of erroneous return statment (Andrew Lunn)
>
> Signed-off-by: Matthew Hagan <mnhagan88@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] net: sfp: Add tx-fault workaround for Huawei MA5671A SFP ONT
2022-05-02 22:33 [PATCH v2] net: sfp: Add tx-fault workaround for Huawei MA5671A SFP ONT Matthew Hagan
2022-05-03 22:18 ` Andrew Lunn
@ 2022-05-04 0:00 ` patchwork-bot+netdevbpf
[not found] ` <20220508161712.wgzrq3wigaa7kobh@pali>
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-05-04 0:00 UTC (permalink / raw)
To: Matthew Hagan
Cc: linux, andrew, hkallweit1, davem, edumazet, kuba, pabeni, netdev,
linux-kernel
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 2 May 2022 23:33:15 +0100 you wrote:
> As noted elsewhere, various GPON SFP modules exhibit non-standard
> TX-fault behaviour. In the tested case, the Huawei MA5671A, when used
> in combination with a Marvell mv88e6085 switch, was found to
> persistently assert TX-fault, resulting in the module being disabled.
>
> This patch adds a quirk to ignore the SFP_F_TX_FAULT state, allowing the
> module to function.
>
> [...]
Here is the summary with links:
- [v2] net: sfp: Add tx-fault workaround for Huawei MA5671A SFP ONT
https://git.kernel.org/netdev/net/c/2069624dac19
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
* Re: [PATCH v2] net: sfp: Add tx-fault workaround for Huawei MA5671A SFP ONT
[not found] ` <20220508161712.wgzrq3wigaa7kobh@pali>
@ 2022-05-08 16:19 ` Pali Rohár
0 siblings, 0 replies; 4+ messages in thread
From: Pali Rohár @ 2022-05-08 16:19 UTC (permalink / raw)
To: Matthew Hagan
Cc: Russell King, Andrew Lunn, Heiner Kallweit, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
On Sunday 08 May 2022 18:17:12 Pali Rohár wrote:
> On Monday 02 May 2022 23:33:15 Matthew Hagan wrote:
> > As noted elsewhere, various GPON SFP modules exhibit non-standard
> > TX-fault behaviour. In the tested case, the Huawei MA5671A, when used
> > in combination with a Marvell mv88e6085 switch, was found to
> > persistently assert TX-fault, resulting in the module being disabled.
>
> Hello! I have some other GPON SFP modules with this issue... which has
> inverted TX-fault signal.
Anyway, I'm planning to send patches for fixing other GPON modules...
> > This patch adds a quirk to ignore the SFP_F_TX_FAULT state, allowing the
> > module to function.
>
> I think that you should rather invert TX-fault signal, instead of
> masking it.
>
> > Change from v1: removal of erroneous return statment (Andrew Lunn)
> >
> > Signed-off-by: Matthew Hagan <mnhagan88@gmail.com>
> > ---
> > drivers/net/phy/sfp.c | 12 +++++++++++-
> > 1 file changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
> > index 4dfb79807823..9a5d5a10560f 100644
> > --- a/drivers/net/phy/sfp.c
> > +++ b/drivers/net/phy/sfp.c
> > @@ -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,12 @@ 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;
> > }
> >
> > @@ -2409,7 +2416,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))
> > --
> > 2.27.0
> >
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-05-08 16:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-02 22:33 [PATCH v2] net: sfp: Add tx-fault workaround for Huawei MA5671A SFP ONT Matthew Hagan
2022-05-03 22:18 ` Andrew Lunn
2022-05-04 0:00 ` patchwork-bot+netdevbpf
[not found] ` <20220508161712.wgzrq3wigaa7kobh@pali>
2022-05-08 16:19 ` Pali Rohár
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.