All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: sfp: fix state loss when updating state_hw_mask
@ 2023-03-17  7:28 Russell King (Oracle)
  2023-03-19 11:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 3+ messages in thread
From: Russell King (Oracle) @ 2023-03-17  7:28 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev

Andrew reports that the SFF modules on one of the ZII platforms do not
indicate link up due to the SFP code believing that LOS indicating that
there is no signal being received from the remote end, but in fact the
LOS signal is showing that there is signal.

What makes SFF modules different from SFPs is they typically have an
inverted LOS, which uncovered this issue. When we read the hardware
state, we mask it with state_hw_mask so we ignore anything we're not
interested in. However, we don't re-read when state_hw_mask changes,
leading to sfp->state being stale.

Arrange for a software poll of the module state after we have parsed
the EEPROM in sfp_sm_mod_probe() and updated state_*_mask. This will
generate any necessary events for signal changes for the state
machine as well as updating sfp->state.

Reported-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Andrew Lunn <andrew@lunn.ch>
Fixes: 8475c4b70b04 ("net: sfp: re-implement soft state polling setup")
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/phy/sfp.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index c02cad6478a8..fb98db61e06c 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -2190,6 +2190,11 @@ static void sfp_sm_module(struct sfp *sfp, unsigned int event)
 			break;
 		}
 
+		/* Force a poll to re-read the hardware signal state after
+		 * sfp_sm_mod_probe() changed state_hw_mask.
+		 */
+		mod_delayed_work(system_wq, &sfp->poll, 1);
+
 		err = sfp_hwmon_insert(sfp);
 		if (err)
 			dev_warn(sfp->dev, "hwmon probe failed: %pe\n",
-- 
2.30.2


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

* Re: [PATCH net] net: sfp: fix state loss when updating state_hw_mask
  2023-03-17  7:28 [PATCH net] net: sfp: fix state loss when updating state_hw_mask Russell King (Oracle)
@ 2023-03-19 11:10 ` patchwork-bot+netdevbpf
  2023-06-03 18:22   ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-03-19 11:10 UTC (permalink / raw)
  To: Russell King; +Cc: andrew, hkallweit1, davem, edumazet, kuba, pabeni, netdev

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Fri, 17 Mar 2023 07:28:00 +0000 you wrote:
> Andrew reports that the SFF modules on one of the ZII platforms do not
> indicate link up due to the SFP code believing that LOS indicating that
> there is no signal being received from the remote end, but in fact the
> LOS signal is showing that there is signal.
> 
> What makes SFF modules different from SFPs is they typically have an
> inverted LOS, which uncovered this issue. When we read the hardware
> state, we mask it with state_hw_mask so we ignore anything we're not
> interested in. However, we don't re-read when state_hw_mask changes,
> leading to sfp->state being stale.
> 
> [...]

Here is the summary with links:
  - [net] net: sfp: fix state loss when updating state_hw_mask
    https://git.kernel.org/netdev/net/c/04361b8bb818

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

* Re: [PATCH net] net: sfp: fix state loss when updating state_hw_mask
  2023-03-19 11:10 ` patchwork-bot+netdevbpf
@ 2023-06-03 18:22   ` Andrew Lunn
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2023-06-03 18:22 UTC (permalink / raw)
  To: David Miller
  Cc: Russell King, hkallweit1, davem, edumazet, kuba, pabeni, netdev

On Sun, Mar 19, 2023 at 11:10:16AM +0000, patchwork-bot+netdevbpf@kernel.org wrote:
> Hello:
> 
> This patch was applied to netdev/net.git (main)
> by David S. Miller <davem@davemloft.net>:
> 
> On Fri, 17 Mar 2023 07:28:00 +0000 you wrote:
> > Andrew reports that the SFF modules on one of the ZII platforms do not
> > indicate link up due to the SFP code believing that LOS indicating that
> > there is no signal being received from the remote end, but in fact the
> > LOS signal is showing that there is signal.
> > 
> > What makes SFF modules different from SFPs is they typically have an
> > inverted LOS, which uncovered this issue. When we read the hardware
> > state, we mask it with state_hw_mask so we ignore anything we're not
> > interested in. However, we don't re-read when state_hw_mask changes,
> > leading to sfp->state being stale.
> > 
> > [...]
> 
> Here is the summary with links:
>   - [net] net: sfp: fix state loss when updating state_hw_mask
>     https://git.kernel.org/netdev/net/c/04361b8bb818

Hi David

This patch was submitted to net, and we can see it was also merged to
netdev/net.git. The Fixes tag of 8475c4b70b04 indicates the problem
was introduced in v6.1-rc1. Yet this fix does not appear in v6.1.31.

Do you have any idea why it has not been backported? It does cleanly
cherry-pick.

Thanks
	Andrew

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

end of thread, other threads:[~2023-06-03 18:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-17  7:28 [PATCH net] net: sfp: fix state loss when updating state_hw_mask Russell King (Oracle)
2023-03-19 11:10 ` patchwork-bot+netdevbpf
2023-06-03 18:22   ` Andrew Lunn

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.