From: sashiko-bot@kernel.org
To: "Markus Stockhausen" <markus.stockhausen@gmx.de>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH net-next v15 10/13] net: mdio: realtek-rtl9300: Open up C22 and C45 space in parallel
Date: Tue, 01 Sep 2026 14:35:38 +0000 [thread overview]
Message-ID: <20260901143538.9FF5A1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260831143439.2404484-11-markus.stockhausen@gmx.de>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] MDIO bus read and write operations incorrectly return non-standard error codes (-ENOENT for unmapped ports and -ENXIO on NACK), which causes the MDIO core to fatally abort bus scanning and registration.
--
commit be85adee2936e783b98939418cafee8c47a996b5
Author: Markus Stockhausen <markus.stockhausen@gmx.de>
net: mdio: realtek-rtl9300: Open up C22 and C45 space in parallel
Until now the MDIO driver supports either access to the C22 or to
the C45 address space of the PHYs. This is due to the fact that
the polling configuration favours one of the address spaces and
limits access to the other space. E.g. when polling is set to
C22 most of the C45 space can not be accessed.
There are however some exceptions from that. EEE register access
is allowed independently from the polling mode [1]. As the
downstream driver already allows parallel C22/C45 access [2] do
this in upstream too.
> diff --git a/drivers/net/mdio/mdio-realtek-rtl9300.c b/drivers/net/mdio/mdio-realtek-rtl9300.c
> index ae7ba86e90b9a..b90972c1dc6a2 100644
> --- a/drivers/net/mdio/mdio-realtek-rtl9300.c
> +++ b/drivers/net/mdio/mdio-realtek-rtl9300.c
> @@ -688,13 +688,10 @@ static int otto_emdio_probe_one(struct device *dev, struct otto_emdio_priv *priv
> return -ENOMEM;
>
> bus->name = "Realtek Switch MDIO Bus";
> - if (priv->smi_bus_is_c45[mdio_bus]) {
> - bus->read_c45 = otto_emdio_read_c45;
> - bus->write_c45 = otto_emdio_write_c45;
> - } else {
> - bus->read = otto_emdio_read_c22;
> - bus->write = otto_emdio_write_c22;
> - }
> + bus->read_c45 = otto_emdio_read_c45;
> + bus->write_c45 = otto_emdio_write_c45;
> + bus->read = otto_emdio_read_c22;
> + bus->write = otto_emdio_write_c22;
[Severity: High]
This is a pre-existing issue, but I noticed that MDIO bus read and write
operations incorrectly return non-standard error codes (-ENOENT for unmapped
ports and -ENXIO on NACK), which causes the MDIO core to fatally abort bus
scanning and registration.
For example, when a PHY address is unmapped, -ENOENT is propagated to the MDIO
core during a C45 or C22 bus read:
drivers/net/mdio/mdio-realtek-rtl9300.c:otto_emdio_phy_to_port() {
...
return -ENOENT;
}
drivers/net/mdio/mdio-realtek-rtl9300.c:otto_emdio_read_c45() {
...
port = otto_emdio_phy_to_port(bus, phy_id);
if (port < 0)
return port;
...
}
And when the PHY NACKs the transaction, it returns -ENXIO instead of
successfully completing a read with 0xffff:
drivers/net/mdio/mdio-realtek-rtl9300.c:otto_emdio_run_cmd() {
...
return cmdstate & info->cmd_fail ? -ENXIO : 0;
}
The get_phy_c22_id() and get_phy_c45_ids() core functions translate any unknown
error (like -ENOENT or -ENXIO) to -EIO. This -EIO error propagates to
__of_mdiobus_parse_phys() and mdiobus_scan_bus_c22()/mdiobus_scan_bus_c45(),
which treat it as a fatal bus error, aborting the scanning and registration
process. Consequently, no PHYs on that bus will be functional.
To comply with the MDIO subsystem and allow fallback scanning to continue, read
functions must return 0xffff (simulating line pull-ups) or explicitly return
-ENODEV (or -EIO, which is safely translated to -ENODEV by the core) when a
device is missing or unmapped.
Should these functions be updated to return compliant error codes to prevent the
MDIO core from fatally aborting bus scanning?
> bus->parent = dev;
> bus->notify_phy_attach = otto_emdio_notify_phy_attach;
> bus->notify_phy_detach = otto_emdio_notify_phy_detach;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260831143439.2404484-1-markus.stockhausen@gmx.de?part=10
next prev parent reply other threads:[~2026-09-01 14:35 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 14:34 [PATCH net-next v15 00/13] net: mdio: realtek-rtl9300: Add RTL83xx support Markus Stockhausen
2026-08-31 14:34 ` [PATCH net-next v15 01/13] dt-bindings: net: realtek,rtl9301-mdio: Add RTL83xx series Markus Stockhausen
2026-08-31 14:34 ` [PATCH net-next v15 02/13] net: mdio: realtek-rtl9300: Add polling documentation Markus Stockhausen
2026-08-31 14:34 ` [PATCH net-next v15 03/13] net: mdio: realtek-rtl9300: deny C45 over C22 access Markus Stockhausen
2026-09-02 0:08 ` Andrew Lunn
2026-09-02 5:36 ` [net-next,v15,03/13] " netdev-bot+sashiko
2026-08-31 14:34 ` [PATCH net-next v15 04/13] net: phy: add phy_detach_internal() helper Markus Stockhausen
2026-09-01 14:35 ` sashiko-bot
2026-09-02 0:09 ` Andrew Lunn
2026-08-31 14:34 ` [PATCH net-next v15 05/13] net: phy: add (*notify_phy_attach/detach)() hooks to struct mii_bus Markus Stockhausen
2026-09-02 0:10 ` Andrew Lunn
2026-09-02 5:36 ` [net-next,v15,05/13] " netdev-bot+sashiko
2026-08-31 14:34 ` [PATCH net-next v15 06/13] net: mdio: realtek-rtl9300: suppress sysfs bind/unbind attributes Markus Stockhausen
2026-09-01 14:35 ` sashiko-bot
2026-09-02 0:12 ` Andrew Lunn
2026-09-02 5:36 ` [net-next,v15,06/13] " netdev-bot+sashiko
2026-08-31 14:34 ` [PATCH net-next v15 07/13] net: mdio: realtek-rtl9300: Configure hardware polling during probing Markus Stockhausen
2026-09-01 14:35 ` sashiko-bot
2026-09-02 0:14 ` Andrew Lunn
2026-09-02 5:36 ` [net-next,v15,07/13] " netdev-bot+sashiko
2026-08-31 14:34 ` [PATCH net-next v15 08/13] net: mdio: realtek-rtl9300: Add page tracking Markus Stockhausen
2026-09-02 0:16 ` Andrew Lunn
2026-09-02 5:36 ` [net-next,v15,08/13] " netdev-bot+sashiko
2026-08-31 14:34 ` [PATCH net-next v15 09/13] net: mdio: realtek-rtl9300: Increase MDIO timeout Markus Stockhausen
2026-08-31 14:34 ` [PATCH net-next v15 10/13] net: mdio: realtek-rtl9300: Open up C22 and C45 space in parallel Markus Stockhausen
2026-09-01 14:35 ` sashiko-bot [this message]
2026-09-02 0:16 ` Andrew Lunn
2026-09-02 5:36 ` [net-next,v15,10/13] " netdev-bot+sashiko
2026-08-31 14:34 ` [PATCH net-next v15 11/13] net: mdio: realtek-rtl9300: Add support for RTL838x Markus Stockhausen
2026-09-02 0:17 ` Andrew Lunn
2026-09-02 5:36 ` [net-next,v15,11/13] " netdev-bot+sashiko
2026-08-31 14:34 ` [PATCH net-next v15 12/13] net: mdio: realtek-rtl9300: Add support for RTL839x Markus Stockhausen
2026-09-02 0:18 ` Andrew Lunn
2026-09-02 5:32 ` AW: " Markus Stockhausen
2026-09-02 5:36 ` [net-next,v15,12/13] " netdev-bot+sashiko
2026-08-31 14:34 ` [PATCH net-next v15 13/13] net: mdio: realtek-rtl9300: reword Kconfig and module description Markus Stockhausen
2026-09-03 2:10 ` [PATCH net-next v15 00/13] net: mdio: realtek-rtl9300: Add RTL83xx support patchwork-bot+netdevbpf
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=20260901143538.9FF5A1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=markus.stockhausen@gmx.de \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.