* [PATCH net 0/3] net: fix optical SFP failures
@ 2025-08-31 17:34 Russell King (Oracle)
2025-08-31 17:34 ` [PATCH net 1/3] net: phy: add phy_interface_weight() Russell King (Oracle)
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Russell King (Oracle) @ 2025-08-31 17:34 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Mathew McBride,
netdev, Paolo Abeni
Hi,
A regression was reported back in April concerning pcs-lynx and 10G
optical SFPs. This patch series addresses that regression, and likely
similar unreported regressions.
These patches:
- Add phy_interface_weight() which will be used in the solution.
- Split out the code that determines the inband "type" for an
interface mode.
- Clear the Autoneg bit in the advertising mask, or the Autoneg bit
in the support mask and the entire advertising mask if the selected
interface mode has no inband capabilties.
Tested with the mvpp2 patch posted earlier today.
drivers/net/phy/phylink.c | 97 ++++++++++++++++++++++++++++++-----------------
include/linux/phy.h | 5 +++
2 files changed, 67 insertions(+), 35 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] 8+ messages in thread
* [PATCH net 1/3] net: phy: add phy_interface_weight()
2025-08-31 17:34 [PATCH net 0/3] net: fix optical SFP failures Russell King (Oracle)
@ 2025-08-31 17:34 ` Russell King (Oracle)
2025-09-02 21:51 ` Andrew Lunn
2025-08-31 17:34 ` [PATCH net 2/3] net: phylink: provide phylink_get_inband_type() Russell King (Oracle)
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Russell King (Oracle) @ 2025-08-31 17:34 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Mathew McBride,
netdev, Paolo Abeni
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
include/linux/phy.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 4c2b8b6e7187..bb45787d8684 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -169,6 +169,11 @@ static inline bool phy_interface_empty(const unsigned long *intf)
return bitmap_empty(intf, PHY_INTERFACE_MODE_MAX);
}
+static inline unsigned int phy_interface_weight(const unsigned long *intf)
+{
+ return bitmap_weight(intf, PHY_INTERFACE_MODE_MAX);
+}
+
static inline void phy_interface_and(unsigned long *dst, const unsigned long *a,
const unsigned long *b)
{
--
2.47.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net 2/3] net: phylink: provide phylink_get_inband_type()
2025-08-31 17:34 [PATCH net 0/3] net: fix optical SFP failures Russell King (Oracle)
2025-08-31 17:34 ` [PATCH net 1/3] net: phy: add phy_interface_weight() Russell King (Oracle)
@ 2025-08-31 17:34 ` Russell King (Oracle)
2025-09-02 21:52 ` Andrew Lunn
2025-08-31 17:34 ` [PATCH net 3/3] net: phylink: disable autoneg for interfaces that have no inband Russell King (Oracle)
2025-09-02 23:30 ` [PATCH net 0/3] net: fix optical SFP failures patchwork-bot+netdevbpf
3 siblings, 1 reply; 8+ messages in thread
From: Russell King (Oracle) @ 2025-08-31 17:34 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Mathew McBride,
netdev, Paolo Abeni
Provide a function to get the type of the inband signalling used for
a PHY interface type. This will be used in the subsequent patch to
address problems with 10G optical modules.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/phylink.c | 79 ++++++++++++++++++++++-----------------
1 file changed, 44 insertions(+), 35 deletions(-)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index c7f867b361dd..8283416ccf5d 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1016,6 +1016,42 @@ static void phylink_pcs_an_restart(struct phylink *pl)
pl->pcs->ops->pcs_an_restart(pl->pcs);
}
+enum inband_type {
+ INBAND_NONE,
+ INBAND_CISCO_SGMII,
+ INBAND_BASEX,
+};
+
+static enum inband_type phylink_get_inband_type(phy_interface_t interface)
+{
+ switch (interface) {
+ case PHY_INTERFACE_MODE_SGMII:
+ case PHY_INTERFACE_MODE_QSGMII:
+ case PHY_INTERFACE_MODE_QUSGMII:
+ case PHY_INTERFACE_MODE_USXGMII:
+ case PHY_INTERFACE_MODE_10G_QXGMII:
+ /* These protocols are designed for use with a PHY which
+ * communicates its negotiation result back to the MAC via
+ * inband communication. Note: there exist PHYs that run
+ * with SGMII but do not send the inband data.
+ */
+ return INBAND_CISCO_SGMII;
+
+ case PHY_INTERFACE_MODE_1000BASEX:
+ case PHY_INTERFACE_MODE_2500BASEX:
+ /* 1000base-X is designed for use media-side for Fibre
+ * connections, and thus the Autoneg bit needs to be
+ * taken into account. We also do this for 2500base-X
+ * as well, but drivers may not support this, so may
+ * need to override this.
+ */
+ return INBAND_BASEX;
+
+ default:
+ return INBAND_NONE;
+ }
+}
+
/**
* phylink_pcs_neg_mode() - helper to determine PCS inband mode
* @pl: a pointer to a &struct phylink returned from phylink_create()
@@ -1043,46 +1079,19 @@ static void phylink_pcs_neg_mode(struct phylink *pl, struct phylink_pcs *pcs,
unsigned int pcs_ib_caps = 0;
unsigned int phy_ib_caps = 0;
unsigned int neg_mode, mode;
- enum {
- INBAND_CISCO_SGMII,
- INBAND_BASEX,
- } type;
-
- mode = pl->req_link_an_mode;
+ enum inband_type type;
- pl->phy_ib_mode = 0;
-
- switch (interface) {
- case PHY_INTERFACE_MODE_SGMII:
- case PHY_INTERFACE_MODE_QSGMII:
- case PHY_INTERFACE_MODE_QUSGMII:
- case PHY_INTERFACE_MODE_USXGMII:
- case PHY_INTERFACE_MODE_10G_QXGMII:
- /* These protocols are designed for use with a PHY which
- * communicates its negotiation result back to the MAC via
- * inband communication. Note: there exist PHYs that run
- * with SGMII but do not send the inband data.
- */
- type = INBAND_CISCO_SGMII;
- break;
-
- case PHY_INTERFACE_MODE_1000BASEX:
- case PHY_INTERFACE_MODE_2500BASEX:
- /* 1000base-X is designed for use media-side for Fibre
- * connections, and thus the Autoneg bit needs to be
- * taken into account. We also do this for 2500base-X
- * as well, but drivers may not support this, so may
- * need to override this.
- */
- type = INBAND_BASEX;
- break;
-
- default:
+ type = phylink_get_inband_type(interface);
+ if (type == INBAND_NONE) {
pl->pcs_neg_mode = PHYLINK_PCS_NEG_NONE;
- pl->act_link_an_mode = mode;
+ pl->act_link_an_mode = pl->req_link_an_mode;
return;
}
+ mode = pl->req_link_an_mode;
+
+ pl->phy_ib_mode = 0;
+
if (pcs)
pcs_ib_caps = phylink_pcs_inband_caps(pcs, interface);
--
2.47.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net 3/3] net: phylink: disable autoneg for interfaces that have no inband
2025-08-31 17:34 [PATCH net 0/3] net: fix optical SFP failures Russell King (Oracle)
2025-08-31 17:34 ` [PATCH net 1/3] net: phy: add phy_interface_weight() Russell King (Oracle)
2025-08-31 17:34 ` [PATCH net 2/3] net: phylink: provide phylink_get_inband_type() Russell King (Oracle)
@ 2025-08-31 17:34 ` Russell King (Oracle)
2025-09-02 22:51 ` Vladimir Oltean
2025-09-02 23:30 ` [PATCH net 0/3] net: fix optical SFP failures patchwork-bot+netdevbpf
3 siblings, 1 reply; 8+ messages in thread
From: Russell King (Oracle) @ 2025-08-31 17:34 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Mathew McBride,
netdev, Paolo Abeni
Mathew reports that as a result of commit 6561f0e547be ("net: pcs:
pcs-lynx: implement pcs_inband_caps() method"), 10G SFP modules no
longer work with the Lynx PCS.
This problem is not specific to the Lynx PCS, but is caused by commit
df874f9e52c3 ("net: phylink: add pcs_inband_caps() method") which added
validation of the autoneg state to the optical SFP configuration path.
Fix this by handling interface modes that fundamentally have no
inband negotiation more correctly - if we only have a single interface
mode, clear the Autoneg support bit and the advertising mask. If the
module can operate with several different interface modes, autoneg may
be supported for other modes, so leave the support mask alone and just
clear the Autoneg bit in the advertising mask.
This restores 10G optical module functionality with PCS that supply
their inband support, and makes ethtool output look sane.
Reported-by: Mathew McBride <matt@traverse.com.au>
Closes: https://lore.kernel.org/r/025c0ebe-5537-4fa3-b05a-8b835e5ad317@app.fastmail.com
Fixes: df874f9e52c3 ("net: phylink: add pcs_inband_caps() method")
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/phylink.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 8283416ccf5d..f1b57e3fdf30 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -3634,6 +3634,7 @@ static int phylink_sfp_config_optical(struct phylink *pl)
{
__ETHTOOL_DECLARE_LINK_MODE_MASK(support);
struct phylink_link_state config;
+ enum inband_type inband_type;
phy_interface_t interface;
int ret;
@@ -3680,6 +3681,23 @@ static int phylink_sfp_config_optical(struct phylink *pl)
phylink_dbg(pl, "optical SFP: chosen %s interface\n",
phy_modes(interface));
+ inband_type = phylink_get_inband_type(interface);
+ if (inband_type == INBAND_NONE) {
+ /* If this is the sole interface, and there is no inband
+ * support, clear the advertising mask and Autoneg bit in
+ * the support mask. Otherwise, just clear the Autoneg bit
+ * in the advertising mask.
+ */
+ if (phy_interface_weight(pl->sfp_interfaces) == 1) {
+ linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
+ pl->sfp_support);
+ linkmode_zero(config.advertising);
+ } else {
+ linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
+ config.advertising);
+ }
+ }
+
if (!phylink_validate_pcs_inband_autoneg(pl, interface,
config.advertising)) {
phylink_err(pl, "autoneg setting not compatible with PCS");
--
2.47.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH net 1/3] net: phy: add phy_interface_weight()
2025-08-31 17:34 ` [PATCH net 1/3] net: phy: add phy_interface_weight() Russell King (Oracle)
@ 2025-09-02 21:51 ` Andrew Lunn
0 siblings, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2025-09-02 21:51 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
Mathew McBride, netdev, Paolo Abeni
On Sun, Aug 31, 2025 at 06:34:33PM +0100, Russell King (Oracle) wrote:
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net 2/3] net: phylink: provide phylink_get_inband_type()
2025-08-31 17:34 ` [PATCH net 2/3] net: phylink: provide phylink_get_inband_type() Russell King (Oracle)
@ 2025-09-02 21:52 ` Andrew Lunn
0 siblings, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2025-09-02 21:52 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
Mathew McBride, netdev, Paolo Abeni
On Sun, Aug 31, 2025 at 06:34:38PM +0100, Russell King (Oracle) wrote:
> Provide a function to get the type of the inband signalling used for
> a PHY interface type. This will be used in the subsequent patch to
> address problems with 10G optical modules.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net 3/3] net: phylink: disable autoneg for interfaces that have no inband
2025-08-31 17:34 ` [PATCH net 3/3] net: phylink: disable autoneg for interfaces that have no inband Russell King (Oracle)
@ 2025-09-02 22:51 ` Vladimir Oltean
0 siblings, 0 replies; 8+ messages in thread
From: Vladimir Oltean @ 2025-09-02 22:51 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Andrew Lunn, Heiner Kallweit, David S. Miller, Eric Dumazet,
Jakub Kicinski, Mathew McBride, netdev, Paolo Abeni
On Sun, Aug 31, 2025 at 06:34:43PM +0100, Russell King (Oracle) wrote:
> Mathew reports that as a result of commit 6561f0e547be ("net: pcs:
> pcs-lynx: implement pcs_inband_caps() method"), 10G SFP modules no
> longer work with the Lynx PCS.
>
> This problem is not specific to the Lynx PCS, but is caused by commit
> df874f9e52c3 ("net: phylink: add pcs_inband_caps() method") which added
> validation of the autoneg state to the optical SFP configuration path.
>
> Fix this by handling interface modes that fundamentally have no
> inband negotiation more correctly - if we only have a single interface
> mode, clear the Autoneg support bit and the advertising mask. If the
> module can operate with several different interface modes, autoneg may
> be supported for other modes, so leave the support mask alone and just
> clear the Autoneg bit in the advertising mask.
>
> This restores 10G optical module functionality with PCS that supply
> their inband support, and makes ethtool output look sane.
>
> Reported-by: Mathew McBride <matt@traverse.com.au>
> Closes: https://lore.kernel.org/r/025c0ebe-5537-4fa3-b05a-8b835e5ad317@app.fastmail.com
> Fixes: df874f9e52c3 ("net: phylink: add pcs_inband_caps() method")
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
I had missed this discussion and was about to report the same problem as
Mathew again.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net 0/3] net: fix optical SFP failures
2025-08-31 17:34 [PATCH net 0/3] net: fix optical SFP failures Russell King (Oracle)
` (2 preceding siblings ...)
2025-08-31 17:34 ` [PATCH net 3/3] net: phylink: disable autoneg for interfaces that have no inband Russell King (Oracle)
@ 2025-09-02 23:30 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-09-02 23:30 UTC (permalink / raw)
To: Russell King
Cc: andrew, hkallweit1, davem, edumazet, kuba, matt, netdev, pabeni
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Sun, 31 Aug 2025 18:34:17 +0100 you wrote:
> Hi,
>
> A regression was reported back in April concerning pcs-lynx and 10G
> optical SFPs. This patch series addresses that regression, and likely
> similar unreported regressions.
>
> These patches:
> - Add phy_interface_weight() which will be used in the solution.
> - Split out the code that determines the inband "type" for an
> interface mode.
> - Clear the Autoneg bit in the advertising mask, or the Autoneg bit
> in the support mask and the entire advertising mask if the selected
> interface mode has no inband capabilties.
>
> [...]
Here is the summary with links:
- [net,1/3] net: phy: add phy_interface_weight()
https://git.kernel.org/netdev/net/c/4beb44a2d62d
- [net,2/3] net: phylink: provide phylink_get_inband_type()
https://git.kernel.org/netdev/net/c/1bd905dfea98
- [net,3/3] net: phylink: disable autoneg for interfaces that have no inband
https://git.kernel.org/netdev/net/c/a21202743f9c
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] 8+ messages in thread
end of thread, other threads:[~2025-09-02 23:30 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-31 17:34 [PATCH net 0/3] net: fix optical SFP failures Russell King (Oracle)
2025-08-31 17:34 ` [PATCH net 1/3] net: phy: add phy_interface_weight() Russell King (Oracle)
2025-09-02 21:51 ` Andrew Lunn
2025-08-31 17:34 ` [PATCH net 2/3] net: phylink: provide phylink_get_inband_type() Russell King (Oracle)
2025-09-02 21:52 ` Andrew Lunn
2025-08-31 17:34 ` [PATCH net 3/3] net: phylink: disable autoneg for interfaces that have no inband Russell King (Oracle)
2025-09-02 22:51 ` Vladimir Oltean
2025-09-02 23:30 ` [PATCH net 0/3] net: fix optical SFP failures patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).