Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: pawlik.dan@gmail.com
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
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	[thread overview]
Message-ID: <179646526871.3146.3818479234866295749@kernel.org> (raw)
In-Reply-To: <20261204093408.1391147-1-pawlik.dan@gmail.com>

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

      parent reply	other threads:[~2026-12-05 10:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  9:34 [PATCH net-next v6] net: sfp: probe RollBall bridge with one MDIO read before the PHY probe Daniel Pawlik
2026-12-04 13:39 ` Andrew Lunn
2026-12-05 10:07 ` netdev-bot+sashiko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179646526871.3146.3818479234866295749@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=kabel@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=olek2@wp.pl \
    --cc=pabeni@redhat.com \
    --cc=pawlik.dan@gmail.com \
    --cc=petr.wozniak@gmail.com \
    --cc=szymon.datko@gmail.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox