From: Nicolai Buchwitz <nb@tipi-net.de>
To: Florian Fainelli <florian.fainelli@broadcom.com>
Cc: netdev@vger.kernel.org, Doug Berger <opendmb@gmail.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-kernel@vger.kernel.org, Mlody12 mlody12 <kudzo51@gmail.com>
Subject: Re: [PATCH net-next v7 1/4] net: phy: Map C45 probe read errors to -ENODEV during bus scan
Date: Sat, 28 Nov 2026 21:54:08 +0100 [thread overview]
Message-ID: <f6eaee9793482f85ee22f67ee198277d@tipi-net.de> (raw)
In-Reply-To: <20261124185820.3954716-2-florian.fainelli@broadcom.com>
On 24.11.2026 19:58, Florian Fainelli wrote:
> get_phy_c22_id() maps a bus read error of -EIO or -ENODEV to -ENODEV,
> so
> that mdiobus_scan_bus_c22() carries on with the next address when
> nothing
> answers. get_phy_c45_ids() only does so for phy_c45_probe_present(); a
> failed read of the devices in package registers is turned into -EIO,
> which
> mdiobus_scan_bus_c45() treats as fatal and which makes the whole
> __mdiobus_register() fail.
>
> 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. mdio-bcm-unimac does not provide read_c45()
> yet, this is enabled by "net: mdio: mdio-bcm-unimac: Add Clause 45
> support" later in this series.
>
> Make get_phy_c45_devs_in_pkg() apply the same mapping as
> get_phy_c22_id()
> to its first read (MDIO_DEVS2): a failure with -EIO or -ENODEV there
> means
> that nothing answered and is reported as -ENODEV. A failure of the
> second
> read (MDIO_DEVS1) happens once the first one succeeded, i.e. once the
> MMD
> has answered, and is still reported as -EIO so that the PHY is not
> silently
> skipped.
>
> get_phy_c45_ids() then handles -ENODEV in the two places that look for
> a
> device at an address: the loop over the MMDs and the MMD 0 fallback. In
> the
> loop, an MMD that does not answer is handled like one that reads as all
> Fs,
> except that the remaining MMDs are not probed: the scan goes straight
> to
> MMD 0, and -ENODEV is only returned if that does not answer either, so
> PHYs
> that only respond on MMD 0 are still found while an empty address costs
> a
> bounded number of bus reads. Carrying on with the remaining MMDs is not
> an
> option: the vendor MMD presence check done on the way fails with the
> same
> bus error on such a controller and ends the scan before MMD 0 is
> reached.
>
> This patch does not change how the other errors are reported: the
> vendor
> MMD presence check done while reading the identifiers and the reads of
> the
> per-MMD identifiers themselves only happen once a device has answered,
> and
> their error is returned as is. The kernel-doc therefore documents "a
> negative error code" rather than -EIO as the only alternative.
>
> This is not limited to mdiobus_scan_bus_c45(): get_phy_c45_ids() is
> reached
> through get_phy_device(bus, addr, true) and phy_get_c45_ids() by every
> C45
> caller. For those, a failed devices in package read is now reported as
> -ENODEV instead of -EIO, which is what C22 callers already get:
>
> - fwnode_mdiobus_register_phy() for "ethernet-phy-ieee802.3-c45" nodes:
> __of_mdiobus_parse_phys() logs that the device is missing and
> registers
> the bus without it, instead of failing the registration.
> - sfp_sm_probe_phy(): the mdio-i2c buses report a PHY that does not
> answer as a read of all Fs, so nothing changes for an absent PHY. The
> only error that can reach this code is an I2C transport error (-EIO)
> on
> a RollBall module: it is now handled like the -ENODEV that C22
> modules
> already get, i.e. retried and, if it persists, reported as "no PHY
> detected" instead of "mdiobus scan returned -EIO" and SFP_S_FAIL.
> - gpy_probe() through phy_get_c45_ids(): the driver core treats -ENODEV
> as
> a silent match rejection rather than a probe failure.
>
> Fixes: 17b447539408 ("net: phy: c45 scanning: Don't consider -ENODEV
> fatal")
> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
> [...]
Thanks,
Nicolai
next prev parent reply other threads:[~2026-11-28 20:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 18:58 [PATCH net-next v7 0/4] net: mdio: Clause 45 support for mdio-bcm-unimac Florian Fainelli
2026-11-24 18:58 ` [PATCH net-next v7 1/4] net: phy: Map C45 probe read errors to -ENODEV during bus scan Florian Fainelli
2026-11-28 20:54 ` Nicolai Buchwitz [this message]
2026-11-24 18:58 ` [PATCH net-next v7 2/4] net: mdio: mdio-bcm-unimac: Define MDIO_OP_SHIFT Florian Fainelli
2026-11-24 18:58 ` [PATCH net-next v7 3/4] net: mdio: mdio-bcm-unimac: Poll for completion at 1us granularity Florian Fainelli
2026-11-24 18:58 ` [PATCH net-next v7 4/4] net: mdio: mdio-bcm-unimac: Add Clause 45 support 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=f6eaee9793482f85ee22f67ee198277d@tipi-net.de \
--to=nb@tipi-net.de \
--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=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