From: netdev-bot+sashiko@kernel.org
To: florian.fainelli@broadcom.com
Cc: netdev@vger.kernel.org, nb@tipi-net.de, carlos.soto@broadcom.com,
justin.chen@broadcom.com, 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 v6 4/4] net: mdio: mdio-bcm-unimac: Add Clause 45 support
Date: Tue, 24 Nov 2026 16:49:27 +0000 [thread overview]
Message-ID: <179553896749.3135.9852837290681703615@kernel.org> (raw)
In-Reply-To: <20261123164835.1733304-5-florian.fainelli@broadcom.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] On ACPI (non-DT) GENET systems, the new C45 scan can create a
phy_device that GENET then attaches to instead of the intended PHY.
- [Low] Adding read_c45/write_c45 slows GENET probe on ACPI (non-DT)
systems by much more than the commit message says.
--
net: mdio: mdio-bcm-unimac: Add Clause 45 support
This adds read_c45/write_c45 callbacks to the UniMAC MDIO driver. Each
access does an ADDR cycle followed by a READ/WRITE cycle, and MDIO_CFG is
switched between C22 and C45 mode only when needed. Every cycle is now
followed by an idle check, resume takes the bus lock around the clock
divider update, and the BMSR workaround is skipped for C45 DT children.
> The platform device that GENET instantiates when it is probed without a
> Device Tree node (e.g.: ACPI) does not mask any address, so it is scanned
> too. Its wait_func is bcmgenet_mii_wait(), which sleeps for up to a timeout
> per frame since GENET's interrupt is not registered yet when the bus is
> registered. That makes the scan slower at probe time on such systems, the
> same way the C22 scan already is.
[Severity: Low]
Could the commit message say how large this slowdown is?
For each empty address, get_phy_c45_ids() does a failing MMD 1 DEVS2
read and then the MMD 0 DEVS2 fallback read. That is two C45 reads, so
four frames (ADDR + READ each). Each frame goes through
bcmgenet_mii_wait():
wait_event_timeout(priv->wq,
!(bcmgenet_umac_readl(priv, UMAC_MDIO_CMD)
& MDIO_START_BUSY),
HZ / 100);
The GENET ISR is not installed at this point, so nothing calls
wake_up(). Each frame sleeps the full HZ/100, which is 4-10 ms depending
on HZ.
With one C22 PHY on the bus, the C45 scan adds about 31 x 4 = 124
sleeping frames. That is roughly 0.5-1.2 s per GENET instance.
The existing C22 cost is about 63 frames: 32 BMSR workaround reads plus
31 failed PHYSID1 reads. Total probe-time MDIO waiting therefore roughly
triples.
Would it be worth stating the size of the delay? It would also help to
explain why the C45 scan cannot be avoided on these buses. Known hardware
here, such as the Raspberry Pi 4's BCM54213PE, is C22-only and gains
nothing from the scan.
> diff --git a/drivers/net/mdio/mdio-bcm-unimac.c b/drivers/net/mdio/mdio-bcm-unimac.c
> index f8e5c1811d96b..b01e99327b561 100644
> --- a/drivers/net/mdio/mdio-bcm-unimac.c
> +++ b/drivers/net/mdio/mdio-bcm-unimac.c
[ ... ]
> @@ -302,6 +408,8 @@ static int unimac_mdio_probe(struct platform_device *pdev)
> bus->parent = &pdev->dev;
> bus->read = unimac_mdio_read;
> bus->write = unimac_mdio_write;
> + bus->read_c45 = unimac_mdio_read_c45;
> + bus->write_c45 = unimac_mdio_write_c45;
[Severity: Medium]
Can this change which PHY GENET attaches to on ACPI systems?
Without a DT node, bcmgenet_mii_register() does:
else
ppd.phy_mask = ~0;
So bus->phy_mask = ~pdata->phy_mask = 0 here. With read_c45 now set,
__mdiobus_register() runs:
if (!prevent_c45_scan && bus->read_c45) {
err = mdiobus_scan_bus_c45(bus);
This covers every address that has no C22 device.
mdiobus_prevent_c45_scan() only skips the scan for Micrel OUIs.
Later, the has_acpi_companion() branch of bcmgenet_mii_probe() does:
phydev = phy_find_first(unimacbus);
This returns the lowest-address phy_device on the bus, whether it is a
C22 or a C45 device.
Suppose something answers C45 ID reads at an address below the intended
C22 PHY. Would GENET then call phy_connect_direct() on that device
instead?
That device could be a C45-only PHY or switch. It could also be a ghost
device from a C22 PHY that misdecodes C45 frames sent to other
addresses. mdiobus_prevent_c45_scan() guards against that case, but only
for Micrel.
This has not been confirmed on known ACPI GENET boards, e.g. RPi4 with
the BCM54213PE at address 1, so it depends on what is on the bus.
There is also a side effect: with bus->read_c45 set, get_phy_device()
falls back to C45 ID probing for any C22 address whose ID reads as 0.
C45 frames now reach devices that only ever saw C22 frames before.
The commit message covers the probe-time slowdown but not this change in
PHY selection. Should the unmasked non-DT bus be kept out of the C45
scan?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261123164835.1733304-1-florian.fainelli%40broadcom.com
prev parent reply other threads:[~2026-11-24 16:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 16:48 [PATCH net-next v6 0/4] net: mdio: Clause 45 support for mdio-bcm-unimac Florian Fainelli
2026-11-23 16:48 ` [PATCH net-next v6 1/4] net: phy: Map C45 probe read errors to -ENODEV during bus scan Florian Fainelli
2026-11-24 16:49 ` netdev-bot+sashiko
2026-11-23 16:48 ` [PATCH net-next v6 2/4] net: mdio: mdio-bcm-unimac: Define MDIO_OP_SHIFT Florian Fainelli
2026-11-23 16:48 ` [PATCH net-next v6 3/4] net: mdio: mdio-bcm-unimac: Poll for completion at 1us granularity Florian Fainelli
2026-11-23 16:48 ` [PATCH net-next v6 4/4] net: mdio: mdio-bcm-unimac: Add Clause 45 support Florian Fainelli
2026-11-24 16:49 ` 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=179553896749.3135.9852837290681703615@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=carlos.soto@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=florian.fainelli@broadcom.com \
--cc=hkallweit1@gmail.com \
--cc=justin.chen@broadcom.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