Article View: linux.kernel.netdev
Article #21955Re: [PATCH net-next v6 4/4] net: mdio: mdio-bcm-unimac: Add Clause 45 support
From: netdev-bot+sashiko
Date: Tue, 24 Nov 2026 16:49
Date: Tue, 24 Nov 2026 16:49
125 lines
12785 bytes
12785 bytes
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
Technical Details
Message-ID:
<179553896749.3135.9852837290681703615@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370586-linux-kernel-netdev=dewy.ruReferences:
<20261123164835.1733304-5-florian.fainelli@broadcom.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370586-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev 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 Organization: Usenet Network Message-ID: <179553896749.3135.9852837290681703615@kernel.org> References: <20261123164835.1733304-5-florian.fainelli@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="4183611"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:mXICAv2R9339i5kLRmb9hHSuYzk= sha256:6v8bwBog7hKaZH3Feym2VnA8nbh+3fW9/ongAYcxGQI= sha1:k+eN4o8LKOhlklHRdD2aioJprdU= sha256:6A9fFhhj6vSDy2VEndegAhgx0tDngQYNp5uxQLPwbjI= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 49098125E2B; Tue, 24 Nov 2026 19:50:05 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IOoL4-7QXJtT; Tue, 24 Nov 2026 19:50:01 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-370586-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id EB7C9125E22; Tue, 24 Nov 2026 19:49:52 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 0EF5342F9A; Tue, 24 Nov 2026 16:49:36 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795538975; b=g4o7AwF0YD9bFY7AcCiAGRkM5+Xcprm+fKVfRv5ZIHR38i1knjy4uDDl1VaK8j3/8OxE ULLytm1bmb5u635oe4QwfKgkON4FQHHLBMsdasmTkZIc7iKPjqw5eS7d8vNh9VeL/h6nt sZc2PGeb2qwcv5Vh6EyWujB4KYQdrvL4R+rbNQ3tM79vvrbGW7c/q4gTv1DMkoqN7qb50 OHjAH+2SOI1es3nb/YT+30NFDaju5T3EmRpe0gvobhetHqSz67jslGPpdxp9vmgjuKm99 xlyzjvWywqEOL7hA+wkEIKJR7d82pTP2eL8Ui6aXoMRqTdQdJB2cyoXLgGcivXRQREw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795538975; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=wYLNAZcvAlxW8drbiBSHvvk3XyZKonPGhZLlrgm0+CU=; b=0+YKqRZsNFnRGfP+5tDDvVZ8nrA4XP08INTUKBoRpEG+Rb59XVE9qBPomFOCy6ibQj2b WVbFDYfbtd+OZprYGTSAeHYt/jbycW70mh+Dm0lOslX4xrxpgVTHdopzQdAMCYzg+UjGU erTESTNe7sB+wxtN3vWla7Dwy1tY+pawDs7vjwy7EdWPKXP45/DBvJVTrZdPpklLJPoS9 7UVYrJRm1eIw8IVAksLjR4vLyCtrlRYqlBh8ZGupETpUBVbq9MPSyu8k9l8iAbFSvraPQ YBK9hVGAJAI+nat3NYkJlfm7sIuc33dqFaYoH9OF4zxn8tzpvJu01lsThHzlch5WcHQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VY4UUBmj; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 45AD8606A691; Tue, 24 Nov 2026 16:49:35 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VY4UUBmj X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795538969; b=FtXZ+8wwq5dqwm/gCGA8ek5DO1qjd2U5oQKmVmFnXHFSVhKvUUunkHeWlxQYIttw9n+t tCzIlMiga//ZhmQyWvfuqTNpoG001+16zRFMU0I6Zq0y12ZV3kbZc30CYTcW4YC7FdKO2 +f+VpMscs2nwM6mLnXnWohJog2REgqtbqiTn7KbxqOfYVvLa63hVmWcQlx30KR+FkCLY+ OpAxa88M7c2ntYtLYk+ADe4vsdvSu/uwav2F2M0brHwcM036SWiPbKVlJgYLIKdTPJXtP iPogbhSBpgUhtetb8Mmxh/yUJNOH6KBPk+MNkrWe4R3R20B0zjxoBa70P8F8b56pkvw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795538969; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=wYLNAZcvAlxW8drbiBSHvvk3XyZKonPGhZLlrgm0+CU=; b=DMXSEK1oixKYCU0ZEP5WMR9OkCc9VeCfrfUs+kgDAlzfFlMRHNZ3dc/OSXoK1z48vRLx O+BzoRzYqsndaEYUOqKDnPjIwkQCKRf/sEmtYqgP7H7JCxiZ2PueSxBdr7zNguzCcOQ16 MpLwBMyKWs8rT+VfCMhCGSVb8KW/6Z6a+V+ejPUscZjTsHQ44uLUEbDGZDqPPZdhTiapY eykGQ6jNw+tPvp4+YT5Dgv6h01Z2I1uTIOpXa0+UwyJMVVpxLnbsZn1NsDGK3FhwkHpRa FCttnFBNEl+GR/mj/xwOk746iu/Jj0WjjC21vUU5KeVIqxFMMS9vMU6EmhUQn3NNsyQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VY4UUBmj; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5741860A2606; Tue, 24 Nov 2026 16:49:29 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE2851F000D0; Tue, 24 Nov 2026 16:49:27 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795538968; bh=wYLNAZcvAlxW8drbiBSHvvk3XyZKonPGhZLlrgm0+CU=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=VY4UUBmj6CUyELYpfvbDSWKr9HAPiBDaTEyPMkyBARELbp96ObcSDI+Z4sztgWq+S EmmQNxyS3w0s556g339p7mvkl3Ai6zq849SMMUQj/ePsaDg78HcnrfZ0+YVp/9ostX f6K8Vt7gZuU9uPCm6Dv+9iSWQPPNhvjst6dImNy09ixDTf7AStiuPpVAL9nHq38WI/ 9Hg4d353tHeGidxyJ8HMGzVx3h4EleKyxf35Uh63Gv5ky14JYOeXtKALQjtlWf2CO5 GnlXAY7T53MqidXdliBi/Pjh+ZilzXabwx9uB9YRFifN6ipoc4iIcJwOLtpcw0++08 SwodWxMOGkI2g== X-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 X-In-Reply-To: <20261123164835.1733304-5-florian.fainelli@broadcom.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list