From: netdev-bot+sashiko@kernel.org
To: florian.fainelli@broadcom.com
Cc: netdev@vger.kernel.org, nb@tipi-net.de, opendmb@gmail.com,
bcm-kernel-feedback-list@broadcom.com, andrew@lunn.ch,
hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
linux-kernel@vger.kernel.org, kudzo51@gmail.com
Subject: Re: [PATCH net-next v3 1/4] net: phy: Map C45 probe read errors to -ENODEV during bus scan
Date: Fri, 20 Nov 2026 02:34:41 +0000 [thread overview]
Message-ID: <179514208109.3136.8422011628328621271@kernel.org> (raw)
In-Reply-To: <20261117233149.1693881-2-florian.fainelli@broadcom.com>
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 3 (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] On MDIO controllers that flag a missing turnaround as a bus
error, get_phy_c45_ids() now treats one failed Devices-In-Package read…
- [Low] The subject says "during bus scan", but get_phy_c45_ids() is
reached through get_phy_device(bus, addr, true) for every C45 caller,…
- [Low] The patch updates the kernel-doc of get_phy_c45_devs_in_pkg() but
leaves the return-value docs of get_phy_c45_ids()…
- [Low] (Baseline: judged a false positive, kept only because
requires_validation=true.) The concern says the commit message's…
Pre-existing issues:
- [Low] (Baseline: dismissed as a pre-existing low-severity issue, kept
only because requires_validation=true.) In the second loop of…
--
net: phy: Map C45 probe read errors to -ENODEV during bus scan
This commit makes get_phy_c45_devs_in_pkg() return the raw bus error. It
maps -EIO/-ENODEV from the devices-in-package reads in get_phy_c45_ids()
to -ENODEV, the same way get_phy_c22_id() does. The intent is to let
mdiobus_scan_bus_c45() move past empty addresses on controllers that
report an unanswered read as a bus error, instead of failing
__mdiobus_register().
> net: phy: Map C45 probe read errors to -ENODEV during bus scan
[Severity: Low]
The subject says "during bus scan". However, every C45 caller reaches
get_phy_c45_ids() through get_phy_device(bus, addr, true). Does the new
mapping also change behaviour outside the scan?
For DT/ACPI nodes compatible with "ethernet-phy-ieee802.3-c45",
fwnode_mdiobus_register_phy() calls get_phy_device() directly:
drivers/net/mdio/fwnode_mdio.c:fwnode_mdiobus_register_phy() {
...
if (is_c45 || fwnode_get_phy_id(child, &phy_id))
phy = get_phy_device(bus, addr, is_c45);
...
}
and __of_mdiobus_parse_phys() handles -ENODEV and -EIO differently:
drivers/net/mdio/of_mdio.c:__of_mdiobus_parse_phys() {
...
if (rc == -ENODEV)
dev_err(&mdio->dev,
"MDIO device at address %d is missing.\n",
addr);
else if (rc)
goto exit;
...
}
Before this patch, a failed MDIO_DEVS1/MDIO_DEVS2 read made bus
registration fail. Now it logs the "missing" message and the bus
registers without that PHY.
SFP behaves the same way. sfp_sm_probe_phy() passes -ENODEV through.
sfp_sm_main() then retries, eventually reports "no PHY detected" and
starts the module. Before, an -EIO from mdio-i2c sent the module to
SFP_S_FAIL.
Real controller faults reported as -EIO, such as a timed out C45 address
phase, will also look like "no device" now.
This matches what get_phy_c22_id() already does. Could the commit message
mention these callers as well?
> MDIO controllers that report a read from an empty address as a bus error
> (e.g. MDIO_READ_FAIL on the UniMAC MDIO block) and that provide read_c45()
> with unmasked addresses therefore cannot be registered: the C45 scan fails
> on the first empty address.
[Severity: Low]
This isn't a bug, but at this point in the series mdio-bcm-unimac.c does
not set bus->read_c45, so the UniMAC example cannot reach
mdiobus_scan_bus_c45() yet.
The later patch "net: mdio: mdio-bcm-unimac: Add Clause 45 support" adds:
bus->read_c45 = unimac_mdio_read_c45;
bus->write_c45 = unimac_mdio_write_c45;
and its C45 read path returns -EIO on MDIO_READ_FAIL. So the premise
holds by the end of the series, and the sentence above is already
conditional on read_c45() being provided.
Could the commit message say that the UniMAC case is enabled by that
follow-up patch?
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index b39e945cebd73..4071041e1051d 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -780,7 +780,7 @@ static int phy_c45_probe_present(struct mii_bus *bus, int prtad, int devad)
> * Description: reads devices in package registers of a MMD at @dev_addr
> * from PHY at @addr on @bus.
> *
> - * Returns: 0 on success, -EIO on failure.
> + * Returns: 0 on success, or the negative error code from the bus read.
> */
[Severity: Low]
This kernel-doc is updated. Should the return value docs of
get_phy_c45_ids() and of the exported phy_get_c45_ids() be updated too?
The phy_get_c45_ids() doc still says:
* Returns zero on success, %-EIO on bus access error, or %-ENODEV if
* the "devices in package" is invalid.
and get_phy_c45_ids() still documents "%-EIO on bus access error". With
this patch, a bus -EIO on the devices-in-package reads is returned as
-ENODEV.
The only user outside this file, gpy_probe() in mxl-gpy.c, returns that
value directly from probe():
if (!phydev->is_c45) {
ret = phy_get_c45_ids(phydev);
if (ret < 0)
return ret;
}
A real bus -EIO there now becomes -ENODEV. The driver core treats that as
a quiet match rejection at dev_dbg level, not a logged probe failure.
[ ... ]
> @@ -845,7 +858,8 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr,
> }
> phy_reg = get_phy_c45_devs_in_pkg(bus, addr, i, &devs_in_pkg);
> if (phy_reg < 0)
> - return -EIO;
> + /* returning -ENODEV doesn't stop bus scanning */
> + return get_phy_c45_probe_err(phy_reg);
> }
[Severity: Medium]
On controllers that report a missing turnaround as a bus error, could
this skip a real PHY whose first probed MMD doesn't answer?
The loop depends on its condition to step past unimplemented MMDs:
for (i = 1; i < MDIO_MMD_NUM && (devs_in_pkg == 0 ||
(devs_in_pkg & 0x1fffffff) == 0x1fffffff); i++) {
The MMD 0 fallback below exists for PHYs such as the Cortina
CS4315/CS4340. Both of these assume that an absent MMD reads back as
0xffff.
With the later C45 patch, UniMAC checks TA, and unimac_mdio_do_read()
returns -EIO for any (addr, devad) pair that doesn't answer:
if (!(bus->phy_ignore_ta_mask & 1 << phy_id) && (cmd & MDIO_READ_FAIL)) {
ret = -EIO;
goto out;
}
So if the MMD 1 read fails, get_phy_c45_ids() now returns -ENODEV here.
No later MMD and no MMD 0 fallback is tried. mdiobus_scan_bus_c45() then
treats the address as empty:
if (IS_ERR(phydev) && (PTR_ERR(phydev) != -ENODEV))
return PTR_ERR(phydev);
The DT path through fwnode_mdiobus_register_phy() reaches the same code.
These cases look affected:
- a PHY with no MMD 1 (PMA/PMD)
- a PHY whose MMD 1 reads 0 and whose next MMD doesn't answer
- a PHY that only answers on MMD 0
I haven't confirmed an in-tree controller and PHY pair that does this.
Before this patch the same setup made bus registration fail with -EIO, so
no configuration that worked before breaks. With the patch, the PHY is
left off the bus without any message.
Would it be more robust to treat an -EIO/-ENODEV devices-in-package read
as "this MMD is absent" (devs_in_pkg set to all ones) and keep walking?
-ENODEV would then be returned only after the MMD 0 read has also failed.
> @@ -855,7 +869,7 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr,
> */
> phy_reg = get_phy_c45_devs_in_pkg(bus, addr, 0, &devs_in_pkg);
> if (phy_reg < 0)
> - return -EIO;
> + return get_phy_c45_probe_err(phy_reg);
>
> /* no device there, let's get out of here */
> if ((devs_in_pkg & 0x1fffffff) == 0x1fffffff)
[Severity: Low]
This is a pre-existing issue, not one introduced by this patch. Further
down in get_phy_c45_ids(), the second loop returns the
phy_c45_probe_present() error unchanged:
if (i == MDIO_MMD_VEND1 || i == MDIO_MMD_VEND2) {
...
ret = phy_c45_probe_present(bus, addr, i);
if (ret < 0)
return ret;
The MII_PHYSID1/MII_PHYSID2 reads right after it return -EIO instead.
This path can also return an errno outside the documented 0/-EIO/-ENODEV
set.
The commit message says reads made after a device has answered are still
reported as -EIO. Should this path be normalized the same way?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117233149.1693881-1-florian.fainelli%40broadcom.com
next prev parent reply other threads:[~2026-11-20 2:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 23:31 [PATCH net-next v3 0/4] net: mdio: Clause 45 support for mdio-bcm-unimac Florian Fainelli
2026-11-17 23:31 ` [PATCH net-next v3 1/4] net: phy: Map C45 probe read errors to -ENODEV during bus scan Florian Fainelli
2026-11-20 2:34 ` netdev-bot+sashiko [this message]
2026-11-17 23:31 ` [PATCH net-next v3 2/4] net: mdio: mdio-bcm-unimac: Define MDIO_OP_SHIFT Florian Fainelli
2026-11-17 23:31 ` [PATCH net-next v3 3/4] net: mdio: mdio-bcm-unimac: Poll for completion at 1us granularity Florian Fainelli
2026-11-17 23:31 ` [PATCH net-next v3 4/4] net: mdio: mdio-bcm-unimac: Add Clause 45 support Florian Fainelli
2026-11-18 8:49 ` Nicolai Buchwitz
2026-11-20 2:34 ` netdev-bot+sashiko
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=179514208109.3136.8422011628328621271@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=florian.fainelli@broadcom.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=kudzo51@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=nb@tipi-net.de \
--cc=netdev@vger.kernel.org \
--cc=opendmb@gmail.com \
--cc=pabeni@redhat.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