Article View: linux.kernel.netdev
Article #19630Re: [PATCH net-next v4 1/4] net: phy: Map C45 probe read errors to -ENODEV during bus scan
From: netdev-bot+sashiko
Date: Fri, 20 Nov 2026 05:38
Date: Fri, 20 Nov 2026 05:38
169 lines
13838 bytes
13838 bytes
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
Technical Details
Message-ID:
<179515311013.3136.13885466048757926038@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367659-linux-kernel-netdev=dewy.ruReferences:
<20261119005943.999981-2-florian.fainelli@broadcom.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367659-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev 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 Organization: Usenet Network Message-ID: <179515311013.3136.13885466048757926038@kernel.org> References: <20261119005943.999981-2-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="3074210"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:M7perdiQ6i8Wm1sGcp4zr8wl7Vw= sha256:UszWAL2v1pKpgLzskd348jSnV2pJ8TmboxFBZzw1WUc= sha1:3+C7Wt42hPjw7eUg2H0OJsgvDyo= sha256:FBn+28uSH2Bknw0tTtGK8/KfhAIQqsggXXDyPcFLIJ4= 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 BAE1F1158B9; Fri, 20 Nov 2026 08:39:01 +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 ehjY2AOD2gt6; Fri, 20 Nov 2026 08:38:56 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-367659-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 4F7711158B3; Fri, 20 Nov 2026 08:38:48 +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 0A2EC1E50BD; Fri, 20 Nov 2026 05:38:39 +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=1795153117; b=qp6X40EfaAveVpaFkjNwHj0FgWxhtKF3cuOxmYWe7SLvSsMFSzDhFG6R2XsJGUWZNowC 3GG0XYS1sRPf7ePaYmWp0ogy8L6R4jwfjM+dWiP49XsOsgrQ5aWPcA5CgPkCQs3BQm8b/ ycTxID2SQq5t5VWivuVyKI0KAlHxDmP/+PAfs3+2/xMJfZImMrbhp7zkB3B1F3j3uUKXd +m687P73GJ+jbhlDBYmtnFe6p3vWBUES/5w9CsKU2E9H4C6i81dQFufNP5ZDxTqS4T8SR Q2YN+VAJtwMwbSbpydbXN7EJhgjY9CZ6JEnDX7SYIN42kYgG7yBuKeneYsdMwdgMu8w== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795153117; 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=XOjSlJvgQP4Iaas7h11mJ3/93ER6A7G5BBfYIFJUboE=; b=Z6GYb0bPyEMxbs/Fp5EQA7wQ1y34Gzjcy6Tfi/7H1FtYGl29w/rcplYMloDBHVJb/H6e ka8JT9hjs1yz8PpH7nt7eEObVUHxu2dCX3yXhTw7Mzy17tbMDi9Skpv3TNm9+1T6mfqnp DhuiDwrhlfnzPOOn5FaGEhHDl/rCLVLCBORMA8T1oJwi7oUnfYXIoOz5aUJdoibjgkIKA klosur/QxHYLJvQgqXgM349jZjFGfixnBYO5YfeS2To/P7CalNTpDqbyiVOIzBNmwdKjk MwPyBqc7DcfRDZmv2TRsf+c7e66WSlKQcz0klDUMMgHluQSja6zh1116iZDXcKscG1w== 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=GdCyH9kV; 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 9849C606A325; Fri, 20 Nov 2026 05:38:37 +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=GdCyH9kV 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=1795153111; b=Dv21FYxGQwJUws5QSJCY+NQn0Nrin5z246asXjeF5ac17eiLHlyRoQu0sE0V3/Bd8nYE pb2jUrklwCogfxDQnlHqbpb6mMG0shSM+HMGvj80ZaqXjDAI9I2zUygcye//GV0Bj7kgb fa5Lbr6ZN7+32of25WVTG2fynEw/ScgjlhkEBqXJ0Szbdiqt6K8wyVX4vry8f4WDY7CVX 99+dEewrBmvYK0AEVtjF8Ujx32IGX703xC022fxTlX702nT3AOYI4q5MOVYaSmFj4u3iz 0yn0uEAbos222QleBJnehEpROpYqswPmyRvepb+nYcj84VA7g4PpErKw0DyJfCoaRjg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795153111; 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=XOjSlJvgQP4Iaas7h11mJ3/93ER6A7G5BBfYIFJUboE=; b=I40BVI3aekuBYBu0qOGB6aG/HISEkYZhKgq2j4tuw0M9h3Hbs23KpLK/RSM1vTGS1lt2 zLIiPA7HCorcg8mXNjJ/ve/HdLpURXonwVy+2HRbAXno4TICdX7rkCW6enI7lkK0A8nEt 7PoymdL6InVDJczeao7JKR2CYPkZINJ3vvZooAsE2T7goLO/CXEGI1iT1sN14t6ffOHqF NEBE/sbURp5zXO/j3wDTHPUU8hYxU4lZqYiuzi0IndNCabw5sJkAa6ZARJCAJRYv4rg/V I3bJSu/sh81rz8F9YFrtqgrng8STk9oqNS9ZeDAjItfkZv8kgrr81u+Ho1JME3Yi7dw== 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=GdCyH9kV; 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 B4E79606A320; Fri, 20 Nov 2026 05:38:31 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93A3E1F000C6; Fri, 20 Nov 2026 05:38:30 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795153111; bh=XOjSlJvgQP4Iaas7h11mJ3/93ER6A7G5BBfYIFJUboE=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=GdCyH9kVDo50BeQqxTan6qurJr8c8eoUCjmIdh9CL7hoAeBKzdvJzcDyH1Fz3g+qa v2YJHqvY03WqpGhspapq3VoZIaUdf1ALBUflZpZ+Op4atVN35MC68xiHeigqFZbeW6 ZxRDAPy5OWKWSfV6LzuV9wdoM7TMJ7Fo8O5m0SbmFzcxFwap4bLTB/JxOOpeB7CoGb B9MoNQfxV7e/chTSD1q1WZL0oeM8Til5eUJSZncGsNYuw0vvSS/Xa9GS2Jyecniasb v0UUyPB9fuj+EhPjaZm2jlk33/5RgZDayVmG2JXtfVO89bugn9Ez8+QbuAzoAmM9c7 Qw9QcUA3Sl2JQ== X-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 X-In-Reply-To: <20261119005943.999981-2-florian.fainelli@broadcom.com> X-sashiko-severity: Low 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