Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] net: sfp: skip PHY probe on bridge-less OEM SFP-10G-T revisions A and B
@ 2026-11-16  9:36 Daniel Pawlik
  2026-11-18 12:37 ` netdev-bot+sashiko
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Pawlik @ 2026-11-16  9:36 UTC (permalink / raw)
  To: linux
  Cc: netdev, davem, edumazet, kuba, pabeni, horms, petr.wozniak,
	maxime.chevallier, olek2, Daniel Pawlik

"OEM SFP-10G-T" modules with vendor revision "A" have no RollBall
I2C-to-MDIO bridge: page 3 of the 0x51 EEPROM passively echoes written
bytes, so every RollBall command times out. With instrumented mdio-i2c,
the CMD register reads back exactly the written command byte (0x02)
forever, with no DONE and no I2C errors. 0x56 reads back all 0xff, so the
PHY is not reachable at all. A genuine RollBall module with the same
vendor and part number (revision "02", AQR113C PHY) on the same board
answers DONE on the first poll and its PHY attaches within ~2 seconds.
A rev B module with an RTL8261BE PHY, reported on the OpenWrt tracker,
hits the same RollBall timeouts. The bridge probe added by
commit 8fe125892f40 ("net: phy: sfp: probe for RollBall I2C-to-MDIO
bridge in mdio-i2c"), since reverted, found no bridge on it, after
which the module worked.

Because the SFP-10G-T quirk forces RollBall, the kernel retries the PHY
probe 25 times at ~21 seconds per attempt, i.e. for over nine minutes,
before giving up and falling back to inband mode. Each attempt runs from
sfp_timeout() with rtnl_lock held, so for the whole window every rtnl
user on the system stalls in ~21 second chunks, including the state
machines of other SFP cages: insertion and removal of a module in another
cage is only processed after the current attempt ends. In one test, a
module pulled from the other cage kept being polled by phylib until the
attempt ended, triggering a WARN from phy_error_precise().

Give the SFP-10G-T entry its own fixup that skips the PHY probe for
revisions "A" and "B", while keeping the forced extended compliance code
so that the module still links up in 10GBASE-R inband mode as before.
Other revisions keep the RollBall fixup unchanged.

Tested on a Banana Pi BPI-R4 with rev A and rev 02 modules: the rev A
module links up at 10G ~16 s after insertion instead of over nine
minutes, and the rev 02 module is unaffected. No rev B module was
available for testing; its match is based on the report above.[1]

[1] https://github.com/openwrt/openwrt/pull/22910

Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
Link: https://lore.kernel.org/netdev/20260624084814.20972-1-petr.wozniak@gmail.com/

---

This does not re-introduce the generic RollBall bridge probe reverted in
commit b521003c27eb ("Revert 'net: phy: sfp: probe for RollBall
I2C-to-MDIO bridge in mdio-i2c'"): the probe path, its timeouts and the
MDIO bus creation for genuine RollBall modules are untouched. It only
narrows the existing "OEM SFP-10G-T" quirk by vendor revision, so modules
that do have the bridge keep the current behaviour.

Further bridge-less revisions of this part number may exist; they can be
added to the fixup once their lack of a bridge is confirmed on hardware.
---
 drivers/net/phy/sfp.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index 915156743701..066f11241afc 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -482,6 +482,28 @@ static void sfp_fixup_rollball_cc(struct sfp *sfp)
 	sfp->id.base.extended_cc = SFF8024_ECC_10GBASE_T_SFI;
 }
 
+static void sfp_fixup_oem_10gt(struct sfp *sfp)
+{
+	/* Revisions A and B of this module have no RollBall I2C-to-MDIO
+	 * bridge (on rev A, page 3 of the 0x51 EEPROM just echoes written
+	 * bytes), so every RollBall command times out and the PHY probe
+	 * keeps retrying for over nine minutes, holding rtnl_lock for ~20
+	 * seconds per attempt. The PHY is not accessible at all, so use the
+	 * module without one.
+	 */
+	if (!memcmp(sfp->id.base.vendor_rev, "A   ", 4) ||
+	    !memcmp(sfp->id.base.vendor_rev, "B   ", 4)) {
+		dev_info(sfp->dev,
+			 "rev %c has no RollBall MDIO bridge, not probing for a PHY\n",
+			 sfp->id.base.vendor_rev[0]);
+		sfp->mdio_protocol = MDIO_I2C_NONE;
+		sfp->id.base.extended_cc = SFF8024_ECC_10GBASE_T_SFI;
+		return;
+	}
+
+	sfp_fixup_rollball_cc(sfp);
+}
+
 static void sfp_quirk_2500basex(const struct sfp_eeprom_id *id,
 				struct sfp_module_caps *caps)
 {
@@ -629,7 +651,7 @@ static const struct sfp_quirk sfp_quirks[] = {
 	// OEM SFP-GE-T is a 1000Base-T module with broken TX_FAULT indicator
 	SFP_QUIRK_F("OEM", "SFP-GE-T", sfp_fixup_ignore_tx_fault),
 
-	SFP_QUIRK_F("OEM", "SFP-10G-T", sfp_fixup_rollball_cc),
+	SFP_QUIRK_F("OEM", "SFP-10G-T", sfp_fixup_oem_10gt),
 	SFP_QUIRK_S("OEM", "SFP-2.5G-T", sfp_quirk_oem_2_5g),
 	SFP_QUIRK_S("OEM", "SFP-2.5G-BX10-D", sfp_quirk_2500basex),
 	SFP_QUIRK_S("OEM", "SFP-2.5G-BX10-U", sfp_quirk_2500basex),
-- 
2.56.1


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

* Re: [PATCH net-next] net: sfp: skip PHY probe on bridge-less OEM SFP-10G-T revisions A and B
  2026-11-16  9:36 [PATCH net-next] net: sfp: skip PHY probe on bridge-less OEM SFP-10G-T revisions A and B Daniel Pawlik
@ 2026-11-18 12:37 ` netdev-bot+sashiko
  0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sashiko @ 2026-11-18 12:37 UTC (permalink / raw)
  To: pawlik.dan
  Cc: linux, netdev, davem, edumazet, kuba, pabeni, horms, petr.wozniak,
	maxime.chevallier, olek2

Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 2

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The new rev "B" branch in sfp_fixup_oem_10gt()
  (drivers/net/phy/sfp.c:494-495) is justified by an RTL8261BE module,…
- [Low] The revision check in sfp_fixup_oem_10gt()
  (drivers/net/phy/sfp.c:494-495) uses a raw 4-byte memcmp() against the…
- [Low] The patch fixes a user-visible problem: link-up takes over nine
  minutes, rtnl_lock is held for ~21 s per attempt and stalls other SFP…

--

net: sfp: skip PHY probe on bridge-less OEM SFP-10G-T revisions A and B

This patch gives the "OEM"/"SFP-10G-T" quirk entry its own fixup,
sfp_fixup_oem_10gt(). For vendor revisions "A" and "B" it sets
MDIO_I2C_NONE and still forces the 10GBASE-T SFI extended compliance
code; other revisions keep using sfp_fixup_rollball_cc(). This avoids a
RollBall PHY probe retry loop that runs for several minutes under
rtnl_lock on modules that have no I2C-to-MDIO bridge.

Link: https://lore.kernel.org/netdev/20260624084814.20972-1-petr.wozniak@gmail.com/

> diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
> index 915156743701b..066f11241afcc 100644
> --- a/drivers/net/phy/sfp.c
> +++ b/drivers/net/phy/sfp.c
> @@ -482,6 +482,28 @@ static void sfp_fixup_rollball_cc(struct sfp *sfp)
>  	sfp->id.base.extended_cc = SFF8024_ECC_10GBASE_T_SFI;
>  }
>  
> +static void sfp_fixup_oem_10gt(struct sfp *sfp)
> +{

[ ... ]

> +	if (!memcmp(sfp->id.base.vendor_rev, "A   ", 4) ||
> +	    !memcmp(sfp->id.base.vendor_rev, "B   ", 4)) {

[Severity: Low]

Should this revision check accept NUL padding, the way the quirk lookup
does?

sfp_lookup_quirk() trims vendor_name and vendor_pn with sfp_strlen(),
which treats both ' ' and '\0' as trailing padding:

drivers/net/phy/sfp.c:sfp_strlen() {
    ...
	/* Trailing characters should be filled with space chars, but
	 * some manufacturers can't read SFF-8472 and use NUL.
	 */
    ...
}

Take an "OEM"/"SFP-10G-T" module with vendor_rev "A\0\0\0" or
"B\0\0\0". It would match the quirk entry, fail both memcmp() checks
here, and fall through to sfp_fixup_rollball_cc(). That brings back the
RollBall retry loop under rtnl_lock that this patch is meant to avoid.

One option is to check that sfp_strlen(sfp->id.base.vendor_rev, 4)
returns 1 and then test vendor_rev[0]. That would use the same padding
rule as the rest of the file.

[Severity: Medium]

Can the rev "B" match reach the module it is meant for?

The commit message bases it on an RTL8261BE module from the OpenWrt
report. Commit 8fe125892f40 ("net: phy: sfp: probe for RollBall
I2C-to-MDIO bridge in mdio-i2c") describes the same RTL8261BE module
like this:

    Its EEPROM reports vendor="OEM", part="SFP-10G-T-I", and -- critically --
    Vendor OUI 00:00:00 ...

That commit also added a separate SFP_QUIRK_F("OEM", "SFP-10G-T-I",
sfp_fixup_rollball) entry so the module would enter the probe path.
Revert b521003c27eb removed that entry again.

The SFP_QUIRK_F() entry here is matched by sfp_match() with
prefix=false, so the length has to match exactly:

drivers/net/phy/sfp.c:sfp_match() {
    ...
	if (prefix ? qs_len > len : qs_len != len)
		return false;
    ...
}

So "SFP-10G-T" never matches a PN of "SFP-10G-T-I". Such a module never
reaches sfp_fixup_oem_10gt(). In the current tree it matches no quirk at
all, so RollBall is not forced on it.

That means the rev B branch only affects modules whose PN is exactly
"SFP-10G-T" and whose vendor_rev is "B   ". The commit message says no
rev B module was tested. The rev 02 (AQR113C) module shows that bridged
versions of this PN do exist. If a bridged rev B "SFP-10G-T" exists, it
would now get MDIO_I2C_NONE and lose its PHY. Today it works with the
PHY attached.

Is there an EEPROM dump showing vendor_pn "SFP-10G-T" and vendor_rev "B"
for the bridge-less RTL8261BE unit? If not, would it be safer to drop
the rev B match?

> +		dev_info(sfp->dev,
> +			 "rev %c has no RollBall MDIO bridge, not probing for a PHY\n",
> +			 sfp->id.base.vendor_rev[0]);
> +		sfp->mdio_protocol = MDIO_I2C_NONE;
> +		sfp->id.base.extended_cc = SFF8024_ECC_10GBASE_T_SFI;
> +		return;
> +	}
> +
> +	sfp_fixup_rollball_cc(sfp);
> +}

[ ... ]

> @@ -629,7 +651,7 @@ static const struct sfp_quirk sfp_quirks[] = {
>  	// OEM SFP-GE-T is a 1000Base-T module with broken TX_FAULT indicator
>  	SFP_QUIRK_F("OEM", "SFP-GE-T", sfp_fixup_ignore_tx_fault),
>  
> -	SFP_QUIRK_F("OEM", "SFP-10G-T", sfp_fixup_rollball_cc),
> +	SFP_QUIRK_F("OEM", "SFP-10G-T", sfp_fixup_oem_10gt),

[Severity: Low]

This isn't a bug, but should this patch have a Fixes: tag?

The entry that always forces RollBall here came from commit
324e88cbe3b7 ("net: sfp: add support for multigig RollBall
transceivers"). The commit message describes problems users can see:
over nine minutes to link up, rtnl_lock stalls that hold up other SFP
cages, and a WARN from phy_error_precise(). There is no Fixes: tag or
stable note to mark this for backporting.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116093605.294365-1-pawlik.dan%40gmail.com

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

end of thread, other threads:[~2026-11-18 12:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16  9:36 [PATCH net-next] net: sfp: skip PHY probe on bridge-less OEM SFP-10G-T revisions A and B Daniel Pawlik
2026-11-18 12:37 ` netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox