🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27327

Re: [PATCH net-next v6] net: sfp: probe RollBall bridge with one MDIO read before the PHY probe

#27327
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 10:07
157 lines
13456 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

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

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] In sfp_sm_probe_for_phy() (drivers/net/phy/sfp.c), the new
  RollBall pre-check turns every negative result from…
- [Low] The commit fixes a user-visible bug but has no Fixes: tag.

--

net: sfp: probe RollBall bridge with one MDIO read before the PHY probe

This patch adds one MDIO read of the PMA/PMD PHY ID register before the
full RollBall PHY probe in sfp_sm_probe_for_phy(). A 0xffff result returns
-ENODEV so the existing retry loop runs again, and the full probe no longer
times out on every register under rtnl_lock. Any other negative result is
logged and returned as -EIO.

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

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

[Severity: Low]
This isn't a bug, but should this have a Fixes: tag?

The RollBall probe path in sfp_sm_probe_for_phy() and the quirk that
forces MDIO_I2C_ROLLBALL on the bridge-less modules both come from the
same commit:

    case MDIO_I2C_ROLLBALL:
        err = sfp_sm_probe_phy(sfp, SFP_PHY_ADDR_ROLLBALL, true);

    SFP_QUIRK_F("OEM", "SFP-10G-T", sfp_fixup_rollball_cc),

That commit is:

Fixes: 324e88cbe3b7 ("net: sfp: add support for multigig RollBall transceivers")

Without the tag, stable trees may not pick up the fix for the multi-minute
rtnl stall.

> diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
> index 915156743701b..1253beba53d7c 100644
> --- a/drivers/net/phy/sfp.c
> +++ b/drivers/net/phy/sfp.c

[ ... ]

> @@ -2263,6 +2264,21 @@ static int sfp_sm_probe_for_phy(struct sfp *sfp)
>  		break;
>  
>  	case MDIO_I2C_ROLLBALL:
> +		/* mdio-i2c reports a RollBall command timeout as 0xffff, both
> +		 * for a bridge that is still booting and for a module without
> +		 * a bridge. Retry after one cheap read instead of a full PHY
> +		 * probe, which times out on every register under rtnl_lock.
> +		 */
> +		ret = mdiobus_c45_read(sfp->i2c_mii, SFP_PHY_ADDR_ROLLBALL,
> +				       MDIO_MMD_PMAPMD, MII_PHYSID1);
> +		if (ret == 0xffff)
> +			return -ENODEV;
> +		if (ret < 0) {
> +			dev_err(sfp->dev, "mdiobus read returned %pe\n",
> +				ERR_PTR(ret));
> +			return -EIO;
> +		}

[Severity: Medium]
Can this turn a retryable probe failure into a permanent one? In
sfp_sm_main(), only -ENODEV is retried:

    ret = sfp_sm_probe_for_phy(sfp);
    if (ret == -ENODEV) {
        if (--sfp->sm_phy_retries) {
            sfp_sm_next(sfp, SFP_S_INIT_PHY,
                        sfp->phy_t_retry);
    ...
    } else if (ret) {
        sfp_sm_next(sfp, SFP_S_FAIL, 0);
        break;
    }

So any negative value from this read other than 0xffff, including -EIO
and -ENODEV, now moves the module straight to SFP_S_FAIL.

Before this patch, the same failure on the first RollBall read went
through sfp_sm_probe_phy()->get_phy_device()->get_phy_c45_ids()->
get_phy_c45_devs_in_pkg(), which maps -EIO and -ENODEV to -ENODEV:

drivers/net/phy/phy_device.c:get_phy_c45_devs_in_pkg() {
    ...
	phy_reg = mdiobus_c45_read(bus, addr, dev_addr, MDIO_DEVS2);
	if (phy_reg < 0)
		/* Like get_phy_c22_id(): returning -ENODEV doesn't stop bus
		 * scanning
		 */
		return (phy_reg == -EIO || phy_reg == -ENODEV) ? -ENODEV : -EIO;
    ...
}

On -ENODEV, get_phy_c45_ids() then tries MMD 0, and it returns -ENODEV if
that read fails the same way. sfp_sm_probe_phy() then hands it back as a
retryable -ENODEV.

-EIO looks reachable on this path. i2c_mii_read_rollball() maps only a
poll -ETIMEDOUT to 0xffff and passes other errors through.
__i2c_transfer_err() returns -EIO on a short transfer:

drivers/net/mdio/mdio-i2c.c:__i2c_transfer_err() {
    ...
	else if (ret != num)
		return -EIO;
    ...
}

drivers/net/mdio/mdio-i2c.c:i2c_mii_read_rollball() {
    ...
	ret = i2c_rollball_mii_poll(bus, bus_addr, res, sizeof(res));
	if (ret == -ETIMEDOUT)
		return 0xffff;
	else if (ret < 0)
		return ret;
    ...
}

Adapters such as i2c-algo-bit also return -EIO on a data NAK.

A single transient -EIO on the first RollBall transaction could happen
while the module MCU is still busy or coming up, even after the password
write in i2c_mii_init_rollball() has succeeded. Would that leave the
module in SFP_S_FAIL with no PHY and no link until it is reinserted or
the netdev is brought down and up?

The v6 changelog says the -EIO return matches "as the full PHY probe
does", but for -EIO and -ENODEV the full probe returns -ENODEV and is
retried.

To match phylib, could this return -ENODEV for 0xffff, -EIO and -ENODEV,
and keep the -EIO/SFP_S_FAIL path for other errors only?

> +
>  		err = sfp_sm_probe_phy(sfp, SFP_PHY_ADDR_ROLLBALL, true);
>  		break;
>  	}

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204093408.1391147-1-pawlik.dan%40gmail.com
Technical Details
Message-ID: <179646526871.3146.3818479234866295749@kernel.org>
Path: mbox-mo1.pugleaf.net!news-ams.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377928-linux-kernel-netdev=dewy.ru
References: <20261204093408.1391147-1-pawlik.dan@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-ams.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377928-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v6] net: sfp: probe RollBall bridge with one MDIO
 read before the PHY probe
Date: Sat, 05 Dec 2026 10:07:48 +0000
Organization: Usenet Network
Message-ID: <179646526871.3146.3818479234866295749@kernel.org>
References: <20261204093408.1391147-1-pawlik.dan@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3003585"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:fe6qb3iD5lbSWMdDARUWAtiJ2xI= sha256:7z0CibiSzC5S3n2yM48+uoUQBSUzHKBJb7yd+nZRMwQ=
	sha1:EFB/gc8gGoNjb/7jUGqGne7sbbM= sha256:dz7yAGKbHop51/r0yJ6V4TMtknVK05CtgHm8MV+ufD8=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id AFA29117DDE; Sat,  5 Dec 2026 13:08:06 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.641
X-Spam-Status: No, score=-3.641 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.142, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
	URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id p22swnPIX188;
	Sat,  5 Dec 2026 13:08:03 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-377928-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id C2F0F117DDA; Sat,  5 Dec 2026 13:07:53 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 2452128B55; Sat,  5 Dec 2026 10:07:52 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796465271;
	b=jDFyrA7IwkabJWiLrvNqto5YKLHSvfwT3bHSHgPxp7ZLqiChUQpBl46tRwb4atJWwg98
	 ukkhu3IuV0Mh8VUbpX/NJFdx2/54Q0x8/tWRsNBbut0OpTIEnA9Vsd+5vj1UcUYNlUmDF
	 yWwaVro96Kk9WrwG8N3Q2N0XfURycrFfrfZ8jKaeZ6EEtCgFq72czygxw3qgPiZKUC+jt
	 rrQlt1hxaMtfasZvO/+fK/qeRz7CZz/RKxYrnlUYv8r42k7h6hQ/6pps3TnuG56CfM8tC
	 H+UkNIw87EAp28CykNzmOdvUI1sTyWc3gyZw+f/Tj8fbcF91LqtXodrmKbj5JO5dkiA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796465271;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=PvUIhy2EKg54gYwEICEtW/BePKnOuYdRpSnrvNsz6mw=;
	b=pu7/QRtxEff50pfvYvrMaTwjfTmBdcd9DIQiCutGHzqOM0k96bBRLyRVs7XdpGyIu3M4
	 tRadAHtpaDhw9Gt+FfTSZpOo2P6ZaVTuWEk+ArzLSxnWsb7TLm/THKhIN+YWdszFeYa2A
	 4xa2DFNvaB/RURTf4+qj+6eW8nmhFmoRtfUcB6IHPEpktF/pdZVSw/mVd4lzzZlhUOdQ8
	 uOkNac5vwYpCeiEfUUKxOeunBmJJlGUDc3LQNv4LrD33R9gX5P/3TnZuhnIIey+oHkhgc
	 BbLhm+FFHTnMtReiWF7ARBZa5yPCkYBRtoiHGLuzcabjrtomQV8NqD7JPyKQ1b/wq+Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=R1MNpGX6;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 58F1C606A699;
	Sat,  5 Dec 2026 10:07:51 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=R1MNpGX6
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796465270;
	b=bzHHbxsjjP0zy79dQ+hziToQ+vFTRByjN+PC21a9hzHjiE+KOk+1hNiifZIvZYyfwG9F
	 OO1+UO2RoL090aBdrB0T76xq5zzY//ufbOc2TaK67U9nYc7NGeq+zFBSzkRVvQUyEs4Rb
	 bbtU7apTjzcbAkW31LZrmIWe0PnJD/6jS/QvSpa7OH160TH+5lwOuqXwmNwG+FF1l8AxI
	 tBgKwo9OsH7eaOLgKPLrksgamGUAcKaXpiTBopPWJJlqJ5VcHTM3PK9a3tYqu5yO9A6d1
	 gUwl/UvVAzJuTzHWUrl9xhxraQnQr372NI5E3ceOzbuL+6PUfgy7Wn32JzwmZ9sdxwA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796465270;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=PvUIhy2EKg54gYwEICEtW/BePKnOuYdRpSnrvNsz6mw=;
	b=mWKNYXaooxi5zSyH/opM8u5xQr2mQakszTiBdpbP98Skcv61AxI2o1GAhEn2QZT4LSFg
	 Zae2rPsKzUu2t2X6phY8BrEf9W5/i4zzjhZ7emTnMy1YgbRfAG7NxMmHHf9pFRveoR9MN
	 SlJENcPu906uizyfVZzFQGoiGvLfERghcpWg5l9RU12iKRf9i5EJxx3wHqc8tWUhDB/jm
	 bxx+bx97uxXrNCFNf9axA3RTz/q7NzZ4tobjzgVZ1HWEcjyk8OKtOs0/Rvg+f3c4I+Ysc
	 1NHcLj6ZVktibim5y63YBkO9+EsEGT03RUxYmJ63CmL0ELkQqHTvvocWD2LN5EaXMxQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=R1MNpGX6;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7744A606A698
	for <netdev@vger.kernel.org>; Sat,  5 Dec 2026 10:07:50 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A9CA1F00936;
	Sat,  5 Dec 2026 10:07:49 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796465270;
	bh=PvUIhy2EKg54gYwEICEtW/BePKnOuYdRpSnrvNsz6mw=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=R1MNpGX6/GoEfHmQGXhGX9X+MApfA3bOIMvTofn8mCM23MasLvAPC4RPRtGih1gJT
	 WG5qKy0vbLy/ogw+PFa08WTvpCkWpllyJu/hrtSzsSh0XSbDCxEMOqOLlWl8qe2P/W
	 QDJDvOeRIrbIDWlkLyfL9a6js+CCaYstHr7zzuhLEHwyo/JNt/13Dc63iEYzpTU/uu
	 wXq7+xG5XlyK0liI5QVMYwin0PIlQVTRkdl//Gkim3zMTxEWAoWJ1XYqFWydnflXPN
	 tWG+2ChBfo2ytHSUFpRNIhAaSuO61/g8f7BJZv9pWa585ApxmOHpeU/UabZ5iogFPP
	 osfvSPJa2ReTw==
X-Cc: kabel@kernel.org, andrew@lunn.ch, hkallweit1@gmail.com,
 linux@armlinux.org.uk, netdev@vger.kernel.org, willemb@google.com,
 andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, petr.wozniak@gmail.com,
 maxime.chevallier@bootlin.com, olek2@wp.pl, szymon.datko@gmail.com
X-In-Reply-To: <20261204093408.1391147-1-pawlik.dan@gmail.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list