From: netdev-bot+sashiko@kernel.org
To: florian.fainelli@broadcom.com
Cc: netdev@vger.kernel.org, opendmb@gmail.com, nb@tipi-net.de,
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 v4 1/4] net: phy: Map C45 probe read errors to -ENODEV during bus scan
Date: Fri, 20 Nov 2026 05:38:30 +0000 [thread overview]
Message-ID: <179515311013.3136.13885466048757926038@kernel.org> (raw)
In-Reply-To: <20261119005943.999981-2-florian.fainelli@broadcom.com>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The -EIO/-ENODEV -> -ENODEV mapping in get_phy_c45_ids()
(drivers/net/phy/phy_device.c) applies to every caller, not only…
- [Low] The commit message gives the UniMAC MDIO block (MDIO_READ_FAIL)
as its example of a controller whose read_c45() reports an empty…
- [Low] The patch rewrites the kernel-doc of get_phy_c45_ids() (lines
826-828) and of the exported phy_get_c45_ids() (lines 1107-1109).
--
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.
get_phy_c45_ids() now maps -EIO/-ENODEV to -ENODEV for the devices in
package reads, both in the MMD loop and in the MMD 0 fallback, which
matches what get_phy_c22_id() does. With this, mdiobus_scan_bus_c45() can
skip empty addresses on controllers that report an empty address as a bus
error.
> 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]
At this commit, drivers/net/mdio/mdio-bcm-unimac.c does not set
bus->read_c45 yet. The UniMAC example therefore can't reach
mdiobus_scan_bus_c45() here.
The read_c45 support comes later in the series, in "net: mdio:
mdio-bcm-unimac: Add Clause 45 support". In that patch
unimac_mdio_do_read() returns -EIO when MDIO_READ_FAIL is set.
Could the commit message say that the UniMAC case depends on that later
patch? That would help anyone who backports this fix on its own through
the Fixes: tag.
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index b39e945cebd73..79f3fa1e9a036 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
[ ... ]
> @@ -810,8 +823,9 @@ static int get_phy_c45_devs_in_pkg(struct mii_bus *bus, int addr, int dev_addr,
> * the PHY identifiers for each device. Return the "devices in package"
> * and identifiers in @c45_ids.
> *
> - * Returns zero on success, %-EIO on bus access error, or %-ENODEV if
> - * the "devices in package" is invalid or no device responds.
> + * Returns zero on success, %-ENODEV if the "devices in package" is invalid or
> + * if no MMD responds (including when the bus reports -EIO or -ENODEV for the
> + * reads that look for a device), or %-EIO on any other bus access error.
> */
[Severity: Low]
Is this list of return values complete? Further down in
get_phy_c45_ids(), the Device Identifier loop still returns the error
from phy_c45_probe_present() unchanged:
drivers/net/phy/phy_device.c:get_phy_c45_ids() {
...
if (i == MDIO_MMD_VEND1 || i == MDIO_MMD_VEND2) {
...
ret = phy_c45_probe_present(bus, addr, i);
if (ret < 0)
return ret;
...
}
So whatever errno the controller's read_c45() returns for MDIO_STAT2 can
reach the caller. That could be -ETIMEDOUT, or an unmapped -EIO/-ENODEV.
The same call in the first loop is mapped.
The raw return predates this patch. However, the new kernel-doc here, and
the same new wording on the exported phy_get_c45_ids(), now reads as a
complete list of zero, -ENODEV or -EIO.
Should this call site be mapped too? The alternative would be to word the
kernel-doc less strictly.
[ ... ]
> @@ -844,8 +858,20 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr,
> continue;
> }
> phy_reg = get_phy_c45_devs_in_pkg(bus, addr, i, &devs_in_pkg);
> - if (phy_reg < 0)
> - return -EIO;
> + if (phy_reg < 0) {
> + ret = get_phy_c45_probe_err(phy_reg);
> + if (ret != -ENODEV)
> + return ret;
> +
[ ... ]
> + devs_in_pkg = 0xffffffff;
> + break;
> + }
> }
>
> if ((devs_in_pkg & 0x1fffffff) == 0x1fffffff) {
> @@ -855,7 +881,8 @@ 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;
> + /* returning -ENODEV doesn't stop bus scanning */
> + return get_phy_c45_probe_err(phy_reg);
[Severity: Low]
The subject limits this change to the bus scan. However,
get_phy_c45_ids() is shared by every get_phy_device(bus, addr, true)
caller and by the exported phy_get_c45_ids(). Is the new return value
intended for those callers as well?
Some of them now get -ENODEV instead of -EIO when the devices in package
reads fail:
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;
...
}
Previously this aborted the bus registration. Now it logs the message and
continues.
drivers/net/phy/sfp.c:sfp_sm_probe_phy() {
...
phy = get_phy_device(sfp->i2c_mii, addr, is_c45);
if (phy == ERR_PTR(-ENODEV))
return PTR_ERR(phy);
...
}
The SFP state machine now retries and then reports "no PHY detected".
Previously it went to SFP_S_FAIL.
gpy_probe() in drivers/net/phy/mxl-gpy.c now passes on -ENODEV from
phy_get_c45_ids() instead of -EIO.
This does look consistent with existing phylib behaviour.
get_phy_c22_id() already applies the same mapping for every
get_phy_device(..., false) caller. The phy_c45_probe_present() branch has
also done it for C45 since commit 17b447539408.
Could the commit message mention these non-scan callers? As written, the
subject suggests the change only affects mdiobus_scan_bus_c45().
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119005943.999981-1-florian.fainelli%40broadcom.com
next prev parent reply other threads:[~2026-11-20 5:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 0:59 [PATCH net-next v4 0/4] net: mdio: Clause 45 support for mdio-bcm-unimac Florian Fainelli
2026-11-19 0:59 ` [PATCH net-next v4 1/4] net: phy: Map C45 probe read errors to -ENODEV during bus scan Florian Fainelli
2026-11-20 5:38 ` netdev-bot+sashiko [this message]
2026-11-19 0:59 ` [PATCH net-next v4 2/4] net: mdio: mdio-bcm-unimac: Define MDIO_OP_SHIFT Florian Fainelli
2026-11-19 0:59 ` [PATCH net-next v4 3/4] net: mdio: mdio-bcm-unimac: Poll for completion at 1us granularity Florian Fainelli
2026-11-19 0:59 ` [PATCH net-next v4 4/4] net: mdio: mdio-bcm-unimac: Add Clause 45 support Florian Fainelli
2026-11-20 5:38 ` netdev-bot+sashiko
2026-11-20 5:16 [PATCH net-next v4 0/4] net: mdio: Clause 45 support for mdio-bcm-unimac Florian Fainelli
2026-11-20 5:16 ` [PATCH net-next v4 1/4] net: phy: Map C45 probe read errors to -ENODEV during bus scan Florian Fainelli
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=179515311013.3136.13885466048757926038@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
all inboxes | Powered by JetHome®