All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] Rework tx fault fixups
@ 2023-10-03 13:33 Russell King (Oracle)
  2023-10-03 13:34 ` [PATCH net-next 1/2] net: sfp: re-implement ignoring the hardware TX_FAULT signal Russell King (Oracle)
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2023-10-03 13:33 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, netdev, Paolo Abeni

Hi,

This series reworks the tx-fault fixup and then improves the Nokia GPON
workaround to also ignore the RX LOS signal as well. We do this by
introducing a mask of hardware pin states that should be ignored,
converting the tx-fault fixup to use that, and then augmenting it for
RX LOS.

 drivers/net/phy/sfp.c | 33 ++++++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 9 deletions(-)

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next 1/2] net: sfp: re-implement ignoring the hardware TX_FAULT signal
  2023-10-03 13:33 [PATCH net-next 0/2] Rework tx fault fixups Russell King (Oracle)
@ 2023-10-03 13:34 ` Russell King (Oracle)
  2023-10-03 13:34 ` [PATCH net-next 2/2] net: sfp: improve Nokia GPON sfp fixup Russell King (Oracle)
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2023-10-03 13:34 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, netdev, Paolo Abeni

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@armlinux.org.uk>
---
 drivers/net/phy/sfp.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index a50038a45250..1f32e936d3ab 100644
--- 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(struct sfp *sfp)
 
 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
@@ -789,7 +789,8 @@ static void sfp_soft_start_poll(struct sfp *sfp)
 
 	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)
@@ -2314,7 +2315,7 @@ static int sfp_sm_mod_probe(struct sfp *sfp, bool report)
 	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 ||
@@ -2337,6 +2338,8 @@ static int sfp_sm_mod_probe(struct sfp *sfp, bool report)
 
 	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;
@@ -2838,10 +2841,7 @@ static void sfp_check_state(struct sfp *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))
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 2/2] net: sfp: improve Nokia GPON sfp fixup
  2023-10-03 13:33 [PATCH net-next 0/2] Rework tx fault fixups Russell King (Oracle)
  2023-10-03 13:34 ` [PATCH net-next 1/2] net: sfp: re-implement ignoring the hardware TX_FAULT signal Russell King (Oracle)
@ 2023-10-03 13:34 ` Russell King (Oracle)
  2023-10-05 17:47 ` [PATCH net-next 0/2] Rework tx fault fixups Russell King (Oracle)
  2023-10-06  1:40 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2023-10-03 13:34 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, netdev, Paolo Abeni

Improve the Nokia GPON fixup - we need to ignore not only the hardware
LOS signal, but also the software implementation as well. Do this by
using the new state_ignore_mask to indicate that we should ignore not
only the hardware RX_LOS signal, and also clear the LOS bits in the
option field.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/phy/sfp.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index 1f32e936d3ab..1016a953226b 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -345,11 +345,26 @@ static void sfp_fixup_long_startup(struct sfp *sfp)
 	sfp->module_t_start_up = T_START_UP_BAD_GPON;
 }
 
+static void sfp_fixup_ignore_los(struct sfp *sfp)
+{
+	/* This forces LOS to zero, so we ignore transitions */
+	sfp->state_ignore_mask |= SFP_F_LOS;
+	/* Make sure that LOS options are clear */
+	sfp->id.ext.options &= ~cpu_to_be16(SFP_OPTIONS_LOS_INVERTED |
+					    SFP_OPTIONS_LOS_NORMAL);
+}
+
 static void sfp_fixup_ignore_tx_fault(struct sfp *sfp)
 {
 	sfp->state_ignore_mask |= SFP_F_TX_FAULT;
 }
 
+static void sfp_fixup_nokia(struct sfp *sfp)
+{
+	sfp_fixup_long_startup(sfp);
+	sfp_fixup_ignore_los(sfp);
+}
+
 // For 10GBASE-T short-reach modules
 static void sfp_fixup_10gbaset_30m(struct sfp *sfp)
 {
@@ -446,7 +461,7 @@ static const struct sfp_quirk sfp_quirks[] = {
 	// Alcatel Lucent G-010S-A can operate at 2500base-X, but report 3.2GBd
 	// NRZ in their EEPROM
 	SFP_QUIRK("ALCATELLUCENT", "3FE46541AA", sfp_quirk_2500basex,
-		  sfp_fixup_long_startup),
+		  sfp_fixup_nokia),
 
 	// Fiberstore SFP-10G-T doesn't identify as copper, and uses the
 	// Rollball protocol to talk to the PHY.
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 0/2] Rework tx fault fixups
  2023-10-03 13:33 [PATCH net-next 0/2] Rework tx fault fixups Russell King (Oracle)
  2023-10-03 13:34 ` [PATCH net-next 1/2] net: sfp: re-implement ignoring the hardware TX_FAULT signal Russell King (Oracle)
  2023-10-03 13:34 ` [PATCH net-next 2/2] net: sfp: improve Nokia GPON sfp fixup Russell King (Oracle)
@ 2023-10-05 17:47 ` Russell King (Oracle)
  2023-10-06  1:40 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2023-10-05 17:47 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Christian Marangi
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, netdev, Paolo Abeni

On Tue, Oct 03, 2023 at 02:33:25PM +0100, Russell King (Oracle) wrote:
> Hi,
> 
> This series reworks the tx-fault fixup and then improves the Nokia GPON
> workaround to also ignore the RX LOS signal as well. We do this by
> introducing a mask of hardware pin states that should be ignored,
> converting the tx-fault fixup to use that, and then augmenting it for
> RX LOS.
> 
>  drivers/net/phy/sfp.c | 33 ++++++++++++++++++++++++---------
>  1 file changed, 24 insertions(+), 9 deletions(-)

FYI, Christian has provided a tested-by:

Tested-by: Christian Marangi <ansuelsmth@gmail.com>

Thanks!

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 0/2] Rework tx fault fixups
  2023-10-03 13:33 [PATCH net-next 0/2] Rework tx fault fixups Russell King (Oracle)
                   ` (2 preceding siblings ...)
  2023-10-05 17:47 ` [PATCH net-next 0/2] Rework tx fault fixups Russell King (Oracle)
@ 2023-10-06  1:40 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-10-06  1:40 UTC (permalink / raw)
  To: Russell King; +Cc: andrew, hkallweit1, davem, edumazet, kuba, netdev, pabeni

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 3 Oct 2023 14:33:25 +0100 you wrote:
> Hi,
> 
> This series reworks the tx-fault fixup and then improves the Nokia GPON
> workaround to also ignore the RX LOS signal as well. We do this by
> introducing a mask of hardware pin states that should be ignored,
> converting the tx-fault fixup to use that, and then augmenting it for
> RX LOS.
> 
> [...]

Here is the summary with links:
  - [net-next,1/2] net: sfp: re-implement ignoring the hardware TX_FAULT signal
    https://git.kernel.org/netdev/net-next/c/e184e8609f8c
  - [net-next,2/2] net: sfp: improve Nokia GPON sfp fixup
    https://git.kernel.org/netdev/net-next/c/5ffe330e40bd

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] 5+ messages in thread

end of thread, other threads:[~2023-10-06  1:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-03 13:33 [PATCH net-next 0/2] Rework tx fault fixups Russell King (Oracle)
2023-10-03 13:34 ` [PATCH net-next 1/2] net: sfp: re-implement ignoring the hardware TX_FAULT signal Russell King (Oracle)
2023-10-03 13:34 ` [PATCH net-next 2/2] net: sfp: improve Nokia GPON sfp fixup Russell King (Oracle)
2023-10-05 17:47 ` [PATCH net-next 0/2] Rework tx fault fixups Russell King (Oracle)
2023-10-06  1:40 ` patchwork-bot+netdevbpf

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.