From: sashiko-bot@kernel.org
To: "Louis-Alexis Eyraud" <louisalexis.eyraud@collabora.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org,
krzk+dt@kernel.org
Subject: Re: [PATCH net-next v3 6/6] net: phy: air_an8801: ensure maximum available speed link use
Date: Wed, 13 May 2026 05:58:29 +0000 [thread overview]
Message-ID: <20260513055830.201A7C2BCB7@smtp.kernel.org> (raw)
In-Reply-To: <20260512-add-airoha-an8801-support-v3-6-1edb34e363ae@collabora.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Hardware link mode configuration is permanently bypassed when autonegotiation is disabled or during rapid link flaps.
- [High] Hardware and software state permanently desynchronize on an MDIO write error.
--
commit 21302fcf08bdf185bc4b77e3f3a5329b1531d7b0
Author: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
net: phy: air_an8801: ensure maximum available speed link use
This commit implements a custom read_status callback for the Airoha AN8801R
PHY to configure the function mode register for 1Gbps or 100M/10M operation
after link speed detection.
> diff --git a/drivers/net/phy/air_an8801.c b/drivers/net/phy/air_an8801.c
> index a0f164cbf92bc..af46951b1a33d 100644
> --- a/drivers/net/phy/air_an8801.c
> +++ b/drivers/net/phy/air_an8801.c
[ ... ]
> +static int an8801r_read_status(struct phy_device *phydev)
> +{
> + int prev_speed, ret;
> + u32 val;
> +
> + prev_speed = phydev->speed;
> +
> + ret = genphy_read_status(phydev);
> + if (ret)
> + return ret;
> +
> + if (phydev->link && prev_speed != phydev->speed) {
Will the hardware link mode configuration be bypassed when autonegotiation
is disabled or during rapid link flaps?
In forced speed mode (AUTONEG_DISABLE), genphy_read_status() delegates to
genphy_read_status_fixed(), which unconditionally sets phydev->speed to the
forced speed even while the link is physically down.
While the cable is unplugged, the state machine polls read_status, and
prev_speed captures the forced speed. When the link finally comes up,
phydev->link becomes true, but prev_speed already matches phydev->speed.
The check evaluates to false, and the register write is bypassed.
Similarly, if the PHY loses hardware state but the link quickly comes back
before the state machine detects a link-down event, phydev->speed remains
unchanged in memory, and the configuration write is skipped.
Should the driver track link state transitions independently by capturing
the old link state before the call (e.g., old_link = phydev->link) and
checking if the link just came up?
> + /* Ensure that PHY switches to 1G speed when available,
> + * by configuring the function mode for either 1G or 100M/10M
> + * operation.
> + * Therefore, set the link mode register, after read_status
> + * determines the link speed.
> + */
> + val = phydev->speed == SPEED_1000 ?
> + AN8801_BPBUS_LINK_MODE_1000 : 0;
> +
> + return an8801_buckpbus_reg_rmw(phydev,
> + AN8801_BPBUS_REG_LINK_MODE,
> + AN8801_BPBUS_LINK_MODE_1000,
> + val);
Can the hardware and software states permanently desynchronize if the
MDIO write fails?
If an8801_buckpbus_reg_rmw() returns an error, phydev->speed has already
been mutated by genphy_read_status(). During the next execution of the
PHY state machine polling cycle, prev_speed will be assigned this
already-updated speed.
Consequently, the prev_speed != phydev->speed condition will evaluate to
false, and the failed hardware update will never be retried, leaving the
PHY hardware permanently misconfigured for the current speed.
Does the driver need to restore phydev->speed = prev_speed on failure to
ensure a retry on the next poll?
> + }
> +
> + return 0;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260512-add-airoha-an8801-support-v3-0-1edb34e363ae@collabora.com?part=6
prev parent reply other threads:[~2026-05-13 5:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 4:33 [PATCH net-next v3 0/6] Introduce Airoha AN8801R series Gigabit Ethernet PHY driver Louis-Alexis Eyraud
2026-05-12 4:33 ` [PATCH net-next v3 1/6] dt-bindings: net: Add support for Airoha AN8801/R GbE PHY Louis-Alexis Eyraud
2026-05-12 4:33 ` [PATCH net-next v3 2/6] net: phy: Add Airoha phy library for shared code Louis-Alexis Eyraud
2026-05-12 12:43 ` Andrew Lunn
2026-05-12 4:33 ` [PATCH net-next v3 3/6] net: phy: air_phy_lib: Factorize BuckPBus register accessors Louis-Alexis Eyraud
2026-05-12 12:45 ` Andrew Lunn
2026-05-13 4:39 ` sashiko-bot
2026-05-12 4:33 ` [PATCH net-next v3 4/6] net: phy: Rename Airoha common " Louis-Alexis Eyraud
2026-05-12 12:45 ` Andrew Lunn
2026-05-12 4:33 ` [PATCH net-next v3 5/6] net: phy: Introduce Airoha AN8801/R Gigabit Ethernet PHY driver Louis-Alexis Eyraud
2026-05-12 10:06 ` Maxime Chevallier
2026-05-13 5:35 ` sashiko-bot
2026-05-12 4:33 ` [PATCH net-next v3 6/6] net: phy: air_an8801: ensure maximum available speed link use Louis-Alexis Eyraud
2026-05-13 5:58 ` sashiko-bot [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=20260513055830.201A7C2BCB7@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=louisalexis.eyraud@collabora.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox