Article View: linux.kernel.netdev
Article #24898Re: [PATCH net 12/14] net: phy: as21xxx: Configure autoneg advertisement via IPC
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 01:50
Date: Tue, 01 Dec 2026 01:50
237 lines
16517 bytes
16517 bytes
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 3 · 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] as21xxx_config_aneg() (drivers/net/phy/as21xxx.c, from line
914) is now the driver's .config_aneg, so phy_config_aneg()…
- [Medium] In as21xxx_config_aneg() (drivers/net/phy/as21xxx.c),
aeon_set_top_speed() (line 970) changes the firmware's top speed…
- [Medium] The commit message says the IPC top-speed command makes the
firmware advertise 'every slower speed the PHY supports', and that the…
- [Low] Both the comment in as21xxx_config_init()
(drivers/net/phy/as21xxx.c line 906-909) and the commit message say…
--
net: phy: as21xxx: Configure autoneg advertisement via IPC
This adds a .config_aneg callback for the AS21xxx PHYs. It sends the
highest advertised BASE-T speed to the firmware over IPC instead of using
genphy_c45_config_aneg(). The top speed is cached so autoneg only restarts
when it changes, and the slower speeds that the firmware advertises along
with it are added to phydev->advertising.
> diff --git a/drivers/net/phy/as21xxx.c b/drivers/net/phy/as21xxx.c
> index 3423448a0cb1c..967ff3020814e 100644
> --- a/drivers/net/phy/as21xxx.c
> +++ b/drivers/net/phy/as21xxx.c
[ ... ]
> +static int as21xxx_config_init(struct phy_device *phydev)
> +{
> + struct as21xxx_priv *priv = phydev->priv;
> +
> + /* The firmware might have lost the top speed, e.g. across a
> + * suspend/resume cycle, make sure the next .config_aneg sends it.
> + */
> + priv->top_spd = 0;
[Severity: Low]
Does this cover suspend/resume on systems where the MAC manages PM?
On resume, .config_init is only reached through mdio_bus_phy_resume() ->
phy_init_hw(), and mdio_bus_phy_resume() returns early:
drivers/net/phy/phy_device.c:mdio_bus_phy_resume() {
...
if (phydev->mac_managed_pm)
return 0;
...
}
phylink_bringup_phy() sets phy->mac_managed_pm when the MAC config asks
for it, and stmmac always asks. Neither phylink_resume() nor the stmmac
resume path calls phy_init_hw(), so priv->top_spd survives resume on those
systems.
If the firmware really did forget the top speed, the next
as21xxx_config_aneg() would take the top_spd == priv->top_spd early return
and not resend it.
Would clearing the cache from a .suspend or .resume callback cover both PM
models? As written, the comment and the commit message seem to promise
more than the code does.
> +
> + return 0;
> +}
[ ... ]
> + top_spd = aeon_top_speeds[i].top_spd;
> +
> + /* Let the advertisement reflect the slower speeds which go on the
> + * wire along with the highest one.
> + */
> + for (i = 0; i < ARRAY_SIZE(aeon_top_speeds); i++)
> + if (aeon_top_speeds[i].top_spd <= top_spd &&
> + linkmode_test_bit(aeon_top_speeds[i].linkmode,
> + phydev->supported))
> + linkmode_set_bit(aeon_top_speeds[i].linkmode,
> + phydev->advertising);
[Severity: Medium]
Can phydev->advertising still differ from what is on the wire?
The commit message says the firmware advertises "every slower speed the
PHY supports". It also says this loop makes phydev->advertising "reflect
what is actually advertised on the wire". But the loop filters on
phydev->supported, and MAC drivers can make that narrower than what the
firmware advertises.
Several non-phylink MAC drivers (ravb, rswitch, rtsn, tsnep, xgene, icssg
and others) call phy_remove_link_mode() to drop half duplex or 10M modes.
phy_set_max_speed() also narrows supported. The IPC can't describe a
subset, so the firmware still advertises those modes, but they never
appear in phydev->advertising.
Phylink MACs are not affected this way, because phylink_bringup_phy()
narrows phy->advertising rather than phy->supported.
The later patch "net: phy: as21xxx: Fix speed and duplex reporting" relies
on this claim. Its as21xxx_resolve_duplex() ANDs lp_advertising with
phydev->advertising.
Suppose the MAC removed 100baseT_Half and the link comes up at 100M with a
half-only partner. No duplex bit is common, so this fallback runs:
phydev->duplex = phydev->speed != SPEED_1000 &&
linkmode_test_bit(half, phydev->supported) ?
DUPLEX_HALF : DUPLEX_FULL;
Wouldn't that report DUPLEX_FULL and configure the MAC for full duplex
while the wire runs half duplex?
> +
> + /* Restarting autoneg takes the link down, so only do it when the
> + * advertisement changed, or has to be sent again.
> + */
> + if (top_spd == priv->top_spd)
> + return 0;
[Severity: Medium]
Now that .config_aneg is set, phy_config_aneg() no longer calls
genphy_c45_config_aneg() for these PHYs. Does that drop the EEE and pause
advertisement writes?
The generic path wrote them from genphy_c45_an_config_aneg():
ret = genphy_c45_an_config_eee_aneg(phydev);
...
ret = phy_modify_mmd_changed(phydev, MDIO_MMD_AN, MDIO_AN_ADVERTISE,
ADVERTISE_ALL | ADVERTISE_100BASE4 |
ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM, adv);
It also ran genphy_c45_an_setup_master_slave(), which is now skipped as
well.
Phylib still tracks this state in software:
- phy_probe() trims advertising_eee by supported_eee and by the DT
eee-broken-* modes.
- phy_disable_eee() zeroes advertising_eee. It is used for MACs without
LPI support, including phylink's mac_supports_eee_ops path:
linkmode_zero(phydev->advertising_eee);
phydev->eee_cfg.tx_lpi_enabled = false;
phydev->eee_cfg.eee_enabled = false;
Both depend on config_aneg to push the state to the hardware. After this
patch, the only code that writes MDIO_AN_EEE_ADV is
genphy_c45_ethtool_set_eee(), and that only runs on an explicit ethtool
--set-eee.
Could MDIO_AN_EEE_ADV keep the firmware default at bring-up even when
phylib thinks EEE is disabled?
Pause changes look affected too. phy_set_asym_pause() does:
linkmode_set_pause(phydev->advertising, tx, rx);
if (!linkmode_equal(oldadv, phydev->advertising) &&
phydev->autoneg)
phy_start_aneg(phydev);
as21xxx_config_aneg() never writes the pause bits. Since the BASE-T top
speed hasn't changed, it returns 0 at the check above and autoneg is not
restarted. phydev->advertising then shows a pause advertisement that the
hardware may not be sending.
The commit message only says the C45 AN registers aren't "properly"
supported, and all its examples are about speed bits. Does the firmware
also ignore MDIO_AN_EEE_ADV and the pause bits in MDIO_AN_ADVERTISE? If
not, should this function still write them?
> +
> + ret = aeon_set_top_speed(phydev, top_spd);
> + if (ret)
> + return ret;
> +
> + if (!priv->top_spd) {
> + /* genphy_c45_pma_setup_forced() clears MDIO_AN_CTRL1_ENABLE,
> + * which restarting autoneg over the IPC doesn't set back.
> + */
> + ret = phy_set_bits_mmd(phydev, MDIO_MMD_AN, MDIO_CTRL1,
> + MDIO_AN_CTRL1_ENABLE);
> + if (ret)
> + return ret;
> + }
> +
> + ret = aeon_restart_aneg(phydev);
> + if (ret)
> + return ret;
> +
> + priv->top_spd = top_spd;
[Severity: Medium]
Can priv->top_spd go stale if aeon_restart_aneg() fails?
By this point aeon_set_top_speed() has already changed the firmware's top
speed. The error return leaves priv->top_spd at the old non-zero value,
although the struct comment defines it as the "Top speed last handed to
the firmware, 0 when it has to be sent again".
For example, take a cache value of IPC_CU_AN_TOP_SPD_2500:
1. A 10G request sends IPC_CU_AN_TOP_SPD_10000.
2. aeon_restart_aneg() fails with an IPC error status or an MDIO error.
3. phy_ethtool_ksettings_set() ignores the _phy_start_aneg() error when
the PHY isn't started.
4. The user goes back to 2500. The top_spd == priv->top_spd check
matches, so nothing is sent.
The firmware keeps the 10000 top speed and uses it at the next
renegotiation that the driver doesn't trigger, such as a cable replug or
a partner restart. Meanwhile phydev->advertising and the cache both say
2500.
The phy_set_bits_mmd() error path is only taken while priv->top_spd is
already 0, so it still gets resent.
Should priv->top_spd be reset to 0 on any error after aeon_set_top_speed()
succeeds?
> +
> + return 0;
> +}
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-as21xxx-fixes-v1-0-1bd2eae6ccbc%40collabora.com
Technical Details
Message-ID:
<179608985959.3146.12162570241619170178@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374620-linux-kernel-netdev=dewy.ruReferences:
<20261130-as21xxx-fixes-v1-12-1bd2eae6ccbc@collabora.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374620-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 12/14] net: phy: as21xxx: Configure autoneg advertisement via IPC Date: Tue, 01 Dec 2026 01:50:59 +0000 Organization: Usenet Network Message-ID: <179608985959.3146.12162570241619170178@kernel.org> References: <20261130-as21xxx-fixes-v1-12-1bd2eae6ccbc@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1587023"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:I/wwWlyYfXyK9S8NefrW4FiKKxs= sha256:xJ1l49E3QNQQNtxayHCWmljzrf20TCKVcq5uE4UGEM4= sha1:mS+FrySTRtBRfLqpqYc8jPZI1mg= sha256:tKpVh1lSyIbtZoiJIc19Y6rBj11VrNJGIwU0u3NqgHc= 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 EB8A31171F7; Tue, 1 Dec 2026 04:51:21 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.5 X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31 tests=[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 IJJuLvcPXrXc; Tue, 1 Dec 2026 04:51:18 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-374620-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 5E6D21171F2; Tue, 1 Dec 2026 04:51:06 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 95EBE601E24; Tue, 1 Dec 2026 01:51:05 +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=1796089861; b=vXmOSMH2OSbjWuzlOomssQubyJZyYtWgxI2M/cr24cjcZos2QDcpjO+sKjBo8pH40p87 pZrLVM1CzffDMpViWgZ2Ms+pKo6YVxzI1Oc7PCnKxry6NcIgUCzpj5fMivWi/1kVovFnc M4jE8ulEV+C7bfekVT2XPyO3Rr8kTgBDCAlMTmVQNsVfqrngZAWTPK+f4jv+iJm9GzrzK +ja86Oy4Q4f4xWlZtA13/xxAElVSCtVJKd1CqnFPau3vacyd692jf+UBspp+K6+ckmzwU 5bOQC/Wf8OnB89apeLsm9P7BtNVWh9Vn1+qPtbblkXpc8v2sgcEjXg01apyNaz+KIIA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796089861; 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=WO7RwebuhvxAWVo2NQNCNXZhV/lnr0DDOWsDT9HgY3s=; b=HHi8nLMMwQrMhJxs98x42eNAsrUlZ0lBMOc/VmPDgm84RU49WPBzpTidOZbYL/3PcC5h Tu+yMvX00onHhOT1ZNcE7sSFDeqOUIF2TnXNZzoGpIBC8GeFeH14XTGnI37f6z4oIqT96 +WC5KDcj+XmoEI1fjlZLwtznDbBFey4KBVSYlsFuSS63Jl0vlfxPNV2LauuCWurre0Nt3 8kADWXwZmq36NofdZBtYL8fp+tRXzbeWR1j3PAmRKFONlT4Z++Y1eHDCe/7i8Y+wJZdrP zA0sJmEPqUFRgu4xj9lzhADlcRxcQV6cLGEh+GWfcFp64n06gnThyKAD/sRm/efP2nw== 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="dgP/Stb3"; 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 D9C05606A33E; Tue, 1 Dec 2026 01:51:01 +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=dgP/Stb3 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=1796089861; b=pYd9WGpvhYXben+gq3CrlGlz+IbLh3NTw4e1lKuLKbvzqfS7lZQEWS7b/yNAh8eAePW9 su65lNZ1zLg+xqunezsh/aTij1DYQ2iwPDsXpIes7pmQNJZFduYK73EVbWe1qaBMaVjjU 6OPsNO7hcVPUXTE3nLc/OY2QWsf3pLC4IPKAl32ifwtmr5cn6qX81h73c/1/GOXq72H5Y KyoIioqhMp3v7pongKo8cpIZnnb3Wha32ZXtqsxNhjibn7b+Y0wjV3BjUkYtG+RcJksNC ylFnZsUlsbh/d22gg829IxidOMZP0Askur0H63LOmKq5OVWRwTEF65W1ZZaq+lY0BKA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796089861; 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=WO7RwebuhvxAWVo2NQNCNXZhV/lnr0DDOWsDT9HgY3s=; b=iKvC6E2EfF9VtRCVemTaRPgHxVQP4XM7cNpaS1e6/u8KaZ+LtROLx6WAhxtqd7RV4Rg2 Qoyd+zGcOjXh+/OyMje78LOEeRNUjQDau5DkqHqdFedmCZSbbN0Kztuol0ylzo42nsx2T LMmTImEGz+rV5l+zbyzbTJn5QDT/n00rKEfr7CRipSqmOdreX0a7YLWzS9XGh9KcSoWgR X46yMRfMary/zRBRzN8lQ9DWYk3DhG0c7a5o95vZFrAUEDgGqqYdAvxBCUtDo081djqfd +la19F2ixN8I5qW1vIXx6uoqWNUzeGxYVG09HN5+ZfCIUD7WRvVqeiCq8KTOLAH58yg== 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="dgP/Stb3"; 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 0843F606A33D for <netdev@vger.kernel.org>; Tue, 1 Dec 2026 01:51:00 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C1211F00897; Tue, 1 Dec 2026 01:50:59 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796089860; bh=WO7RwebuhvxAWVo2NQNCNXZhV/lnr0DDOWsDT9HgY3s=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=dgP/Stb3W3lnGf4PRL9Vea8rySIBwED4cZ7TbNCgK4sc4FHmhiE/yBXqBp3b2p/Zi ilY9OvL5NgwCfasJBBpVNp4bIkqkdXB+HCfjJcoinBO763NnoAoKnBgH1mgZkV8pKe XDUqWXQPNeeENW7jmc1CjHSGnpec635K5ME/L7VnmVtQdm2CCfuTfPEud4BHe+2+xm tFPiqRcUkz2mq6Ce1+PCce5kL7tS9w6tzDlBSNeQr3/d+vNprKnKfQfx/KfVEaJRBa UfxFSbB+lIwY02gD6U5xZzfFEnhrmxU55XquQpWZvemdserkwgCJMiU7P8Iyr4mESN U5Z5lvnCqw6cA== X-Cc: ansuelsmth@gmail.com, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, kernel@collabora.com, netdev@vger.kernel.org X-In-Reply-To: <20261130-as21xxx-fixes-v1-12-1bd2eae6ccbc@collabora.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