🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26910

Re: [PATCH net-next 2/2] net: phy: realtek: add support for the RTL8251B 5Gbps PHY

#26910
From: netdev-bot+sashiko
Date: Fri, 04 Dec 2026 11:32
154 lines
13461 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · 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] The patch fixes the configure-autoneg path but not the
  restart-autoneg path.
- [Medium] The new RTL8251B entry in realtek_drvs[] neither programs nor
  tracks the PHY's host-side SerDes mode.
- [Low] The changelog says an AI assistant drafted the code and the
  changelog, but it never says the new driver entry was tested on…

--

net: phy: realtek: add support for the RTL8251B 5Gbps PHY

This adds a Clause 45 phy_driver entry for the mass production RTL8251B
(PHY ID 0x001cc86a). It matches on the C45 device ID and reuses the
RTL8224 helpers for features, autoneg configuration, link status, suspend
and resume.

> The code and this changelog were drafted with the help of an AI coding
> assistant (Claude, claude-opus-5-5).

[Severity: Low]
This isn't a bug, but could the changelog say how the new entry was tested
on the SR-S5G3008?

The changelog describes the failure before the patch. It doesn't say
whether the link then came up at 5G/2.5G/1G with the correct speed read
from PHYSR.

Documentation/process/generated-content.rst suggests saying how the
submission was tested. For longer sessions it also suggests a summary of
the prompts and of the kind of help the assistant gave.

> diff --git a/drivers/net/phy/realtek/realtek_main.c b/drivers/net/phy/realtek/realtek_main.c
> index ece327d3cfc37..1a91b62a845a2 100644
> --- a/drivers/net/phy/realtek/realtek_main.c
> +++ b/drivers/net/phy/realtek/realtek_main.c

[ ... ]

> @@ -3409,6 +3416,14 @@ static struct phy_driver realtek_drvs[] = {
>  		.resume		= rtlgen_resume,
>  		.read_page	= rtl821x_read_page,
>  		.write_page	= rtl821x_write_page,
> +	}, {
> +		.match_phy_device = rtl8251b_c45_match_phy_device,
> +		.name		= "RTL8251B 5Gbps PHY",
> +		.get_features	= rtl822x_c45_get_features,
> +		.config_aneg	= rtl822x_c45_config_aneg,

[Severity: Medium]
This entry moves config_aneg and read_status to Clause 45. Does restarting
autoneg still go over Clause 22 on this PHY?

There is no driver hook for restarting autoneg, so phy_restart_aneg()
chooses the access method itself:

drivers/net/phy/phy.c:phy_restart_aneg() {
	...
	if (phydev->is_c45 && !(phydev->c45_ids.devices_in_package & BIT(0)))
		ret = genphy_c45_restart_aneg(phydev);
	else
		ret = genphy_restart_aneg(phydev);
	...
}

The commit message says devices-in-package bit 0 is set on the RTL8251B.
That means this takes the genphy_restart_aneg() branch, which does a
read-modify-write of MII_BMCR over Clause 22. The commit message says that
kind of access fails on the RTL9303 MDIO buses.

Two user-reachable paths end up here:

ethtool -r:
  phy_ethtool_nway_reset() or phylink_ethtool_nway_reset()
    phy_restart_aneg()
      genphy_restart_aneg()

ethtool --set-eee:
  phy_ethtool_set_eee()
    genphy_c45_ethtool_set_eee()
      genphy_c45_an_config_eee_aneg()   <- writes MMD 7 over C45
      phy_restart_aneg()                <- fails over C22

In the EEE case, the new advertisement is already in MMD 7 when
phy_restart_aneg() fails. After that, phy_ethtool_set_eee() restores
phydev->eee_cfg to old_cfg.

Wouldn't the PHY then keep advertising the new EEE modes, without
renegotiating, while phydev->eee_cfg holds the old configuration?

Normal link bring-up through the state machine doesn't call
phy_restart_aneg(), so this shouldn't put the PHY in the error state. The
problem is that ethtool -r and EEE changes would fail on this board.

> +		.read_status	= rtl822x_c45_read_status,

[Severity: Medium]
Does this entry need to program or track the host-side SerDes mode?

These helpers come from the RTL8224, which has a fixed USXGMII-QXGMII host
interface. This entry has no config_init, inband_caps/config_inband or
get_rate_matching. Also, rtl822x_c45_read_status() only decodes PHYSR for
the copper speed and never updates phydev->interface.

The RTL8221B entries in the same driver handle a configurable SerDes in
three places:

  - rtl822xb_config_init() calls rtl822x_set_serdes_option_mode(), which
    sets the SerDes option, possible_interfaces and rate_matching.
  - rtl822xb_get_rate_matching() reports the rate matching mode.
  - The read_status callback follows the SerDes mode:

static int rtl822xb_c45_read_status(struct phy_device *phydev)
{
	...
	ret = rtl822x_c45_read_status(phydev);
	if (ret < 0)
		return ret;

	rtl822xb_update_interface(phydev);
	...
}

Straps or the bootloader might set the RTL8251B SerDes to switch modes
with link speed. In that case phydev->interface would stay at the DT
phy-mode. The MAC/PCS would not be reconfigured when the link comes up at
2.5G/1G/100M.

The SerDes might instead be set up for pause-based rate adaptation. Then
phylink would assume RATE_MATCH_NONE and configure the MAC for the copper
speed.

Is the SerDes mode on this PHY known to be fixed? Or does this entry rely
on strap or firmware state being set up a certain way?

> +		.suspend	= genphy_c45_pma_suspend,
> +		.resume		= rtlgen_c45_resume,
>  	}, {

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201203114.1274260-1-jmulesa%40gmail.com
Technical Details
Message-ID: <179638396294.3146.4583844668584020212@kernel.org>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377312-linux-kernel-netdev=dewy.ru
References: <20261201203114.1274260-3-jmulesa@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377312-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 2/2] net: phy: realtek: add support for the
 RTL8251B 5Gbps PHY
Date: Fri, 04 Dec 2026 11:32:42 +0000
Organization: Usenet Network
Message-ID: <179638396294.3146.4583844668584020212@kernel.org>
References: <20261201203114.1274260-3-jmulesa@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2751887"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:C01ldf3KlY0VCSzIP4cIG9PPWPg= sha256:6jslwbRGuBOEMP5Mn44M6RXBFD2CKL2+PZXEeBHBtJw=
	sha1:A8N80DRVA5Lk9kvs0otqqrYu/J0= sha256:ikj2Ur/sw1Gib+0pnUnVNKsGrKj0nuBIXuzoNXft8OM=
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 31D12117BD5; Fri,  4 Dec 2026 14:34:36 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.641
X-Spam-Status: No, score=-3.641 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.142, 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 GHbNAz2JAGq1;
	Fri,  4 Dec 2026 14:34:29 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-377312-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id A8163117AFF; Fri,  4 Dec 2026 14:34:18 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 0EED8289AF; Fri,  4 Dec 2026 11:33:11 +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=1796383965;
	b=IFqKVBc6GPzqECv/wccQO3Rst6hqJyvd68Lm5JKGONiKRGdrh8oZ8/FITfGSmD1i8Fy6
	 5ZDGi+cjSzL8l/G7xudmUY9d+dnOhy2WmJRQ7UUB/NyFpWeKl+7Rbzl8qfGxC2q6mgH1t
	 fb/ELJYZXPkYyLKUmI5EQgyk83yWGEZJMZryfyvLQm7VQREjT4y25B2DSD/RcI0wde3Tw
	 7UeeeyYpZLx+lmI0wrLVlzbC/2T0+oBDZCwkw2fEO9k3UPhnoabSv7HQI4nGDWExsPE4r
	 BOlw6E60BjlJDbhfFAmwZzRjnCWbsV7SNwHU6Mrl0NHi5cnGXDfr5FouDelOqk94stw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796383965;
	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=7a3Z+Wrxuvnbx/0EHMek3+kmobawpjO5UbNr++8k2n4=;
	b=F7CdHVf+y2EiSXn0IJhF+8EWuB3eTLSe9mmc4NReok8nErm+7w5+C7FI1XnO7QTGES5v
	 PF7u82fznMT6JouEdcSK75UTmdgbqIbzqDmdq4VSGOZfNo7nkmWeq8b8YrU9qg1ouu28q
	 qwWWQAZfVFc2LMf7mQfWOMXzy1LIt9paDTM6YMBVkklmkMgLzDYKJi/rQkMQdrltnTEY/
	 e/AMDK6byWinTbS9y1/JRdjEXqwX+vtQoIUOkEdK7Jkkx0XCNHMmmODK1m8HTNkU0o1w8
	 iSrSfWe7YY/sa5vTrrpmCAZ6waoBM6cEldgz8rsnEzbk+zy6zU8ClOjzj5nvd0MKlsw==
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=n5cwnlK7;
	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 DB028606A332;
	Fri,  4 Dec 2026 11:32:45 +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=n5cwnlK7
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=1796383965;
	b=LFb0YfaAJgh4PTPI7hiL+3FqJWqmqT8xl1hs29Ob+EqGMrExPfGozkRMAEckeU0rn24R
	 c5QnyT4GS6JMO8Htyr2DnArP3hvYAHrATW74expW2Xw36wP6tqm3dK3xbC4esqZLz6Apu
	 jfu3H71s16n0LCnsu8F2VcwphBst8TF/dPE6QD3YRKSn0/QpnZ1NcwWvl7qWN8Ex+M5bm
	 nbwWzDV+EMVxjk7woArV3FExN20umgfBQ+++AU887jTYf72p2306UHRwCoi6ExFx5Ly8i
	 /JFSynizl1tVh0++WsOZcp88IzXvlbq24I6JFv33m8/j3hlvs/kyWrM+2X+CXIOO6ZQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796383965;
	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=7a3Z+Wrxuvnbx/0EHMek3+kmobawpjO5UbNr++8k2n4=;
	b=PjshSjI1LUG78LLL03ahiterGC7E68D7KsCj4QBkytH043ofA/jvYisM4G1qSnFDsssY
	 t2azUqcK+/3sP1ie4chjdU5QtA5yXoDOBBmVjqExWwpG7VEbBwy/Wggjdif8dZJ+AzqDe
	 PB7AwOKftaSNEAsdfw4sBm4Reiv3WvV3lXcWbWdgGene5KaT8KFHamrzP1kP1uOmrZNv/
	 yMGibL9cCzQ9qIpXvz8XqyeX81QNereUxODcJYU2GFSfsyJj3afFzG6V6FqqxpbH64xUj
	 ew4OGM+FjLqSY4c8EpqYmZlSeTBJmby1KHDaEIwiRO5b3kJQO+yS8BP1UdASIV+LkxA==
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=n5cwnlK7;
	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 0750A606A688
	for <netdev@vger.kernel.org>; Fri,  4 Dec 2026 11:32:44 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70ACA1F00897;
	Fri,  4 Dec 2026 11:32:43 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796383964;
	bh=7a3Z+Wrxuvnbx/0EHMek3+kmobawpjO5UbNr++8k2n4=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=n5cwnlK7kq+vkjD7g6gZKTJT7RCnvM016NqgyyezdXpNnq5cou9NKOTj0Ty1/bdnd
	 iDeMxdtkS16R5qt7M9bRslGv8K4gAJocC+4BEMiAQyYkFdZGilBsOk/zUAs22qU7vM
	 BJhzuEAWx2XXJwXhnfK0G642AZcgVVQprkz5EEQ8iqc4YKEDh+bJZnFCMCP8/Voxk5
	 QB9+ufZyuGBc+BvwKWlY5Nm2nGDD5TAkR0QVkZNEzTgP0t8YdP+588TLQfc6mHwKSt
	 Bpb0en7aSk4H+GGs343vKGJz/jrmFJTFNxhqfoiABBVpvQ5OH3H8Xu6hmrZtRCj2E9
	 6Jd7fCkkhNwIA==
X-Cc: netdev@vger.kernel.org, andrew@lunn.ch, hkallweit1@gmail.com,
 linux@armlinux.org.uk, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, markus.stockhausen@gmx.de
X-In-Reply-To: <20261201203114.1274260-3-jmulesa@gmail.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