Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Louis-Alexis Eyraud" <louisalexis.eyraud@collabora.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH net-next v5 6/6] net: phy: air_an8801: ensure maximum available speed link use
Date: Sat, 30 May 2026 00:48:49 +0000	[thread overview]
Message-ID: <20260530004849.D53181F00899@smtp.kernel.org> (raw)
In-Reply-To: <20260526-add-airoha-an8801-support-v5-6-01aea8dee69b@collabora.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] If the MDIO register write in `an8801r_read_status()` fails, the software state (`phydev->speed`) is left updated while the hardware is not configured for the new speed. This prevents subsequent retries and permanently misconfigures the PHY datapath until the link drops again.
--

commit 755d222adefc1329362882564596b829427a8bc6
Author: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>

net: phy: air_an8801: ensure maximum available speed link use

This commit configures the function mode of the Airoha AN8801R PHY for 1G
or 100M/10M operation after link detection. It implements a custom
read_status callback that writes to the link mode register based on the
detected speed.

> diff --git a/drivers/net/phy/air_an8801.c b/drivers/net/phy/air_an8801.c
> index aa24bb182d645..f97c78e430237 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) {
> +		phydev->speed = SPEED_UNKNOWN;
> +		return 0;
> +	}
> +
> +	if (prev_speed != phydev->speed) {
> +		/* 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);

[Severity: Medium]
If the MDIO register write fails, does this leave the PHY state permanently
misconfigured until the link drops again?

genphy_read_status() successfully updates phydev->speed, but if
an8801_buckpbus_reg_rmw() fails, it returns an error. On the next polling
interval, prev_speed will now match phydev->speed, making the condition
check evaluate to false.

This means the register write will be skipped on subsequent retries,
leaving the MAC thinking the link is up at the new speed while the PHY
hardware remains physically in the incorrect mode.

Could the error path revert phydev->speed to prev_speed on failure, or
could the hardware register state be re-evaluated instead of relying on
the software state transition?

> +	}
> +
> +	return 0;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260526-add-airoha-an8801-support-v5-0-01aea8dee69b@collabora.com?part=6

  parent reply	other threads:[~2026-05-30  0:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26 14:58 [PATCH net-next v5 0/6] Introduce Airoha AN8801R series Gigabit Ethernet PHY driver Louis-Alexis Eyraud
2026-05-26 14:58 ` [PATCH net-next v5 1/6] dt-bindings: net: Add support for Airoha AN8801R GbE PHY Louis-Alexis Eyraud
2026-05-30  0:48   ` sashiko-bot
2026-05-26 14:58 ` [PATCH net-next v5 2/6] net: phy: Add Airoha phy library for shared code Louis-Alexis Eyraud
2026-05-26 14:58 ` [PATCH net-next v5 3/6] net: phy: air_phy_lib: Factorize BuckPBus register accessors Louis-Alexis Eyraud
2026-05-26 14:58 ` [PATCH net-next v5 4/6] net: phy: Rename Airoha common " Louis-Alexis Eyraud
2026-05-26 14:58 ` [PATCH net-next v5 5/6] net: phy: Introduce Airoha AN8801R Gigabit Ethernet PHY driver Louis-Alexis Eyraud
2026-05-28  1:29   ` Andrew Lunn
2026-05-30  0:48   ` sashiko-bot
2026-05-26 14:58 ` [PATCH net-next v5 6/6] net: phy: air_an8801: ensure maximum available speed link use Louis-Alexis Eyraud
2026-05-28  1:30   ` Andrew Lunn
2026-05-30  0:48   ` sashiko-bot [this message]
2026-05-28  1:50 ` [PATCH net-next v5 0/6] Introduce Airoha AN8801R series Gigabit Ethernet PHY driver patchwork-bot+netdevbpf

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=20260530004849.D53181F00899@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.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