Article View: linux.kernel.netdev
Article #5234Re: [PATCH net-next v6 8/9] net: dsa: realtek: rtl8365mb: re-latch the family D SerDes
From: netdev-bot+sashiko
Date: Tue, 20 Oct 2026 01:41
Date: Tue, 20 Oct 2026 01:41
136 lines
12826 bytes
12826 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 0
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] rtl8365mb_conduit_state_change() never looks at its `conduit`
argument.
--
net: dsa: realtek: rtl8365mb: re-latch the family D SerDes
On family D chips, this adds a delayed work item that repeatedly parks
and restores SDS_MISC. That drives the DISABLE -> HSGMII edge the SerDes
receiver needs in order to latch, and the work keeps checking the link
after that. Episodes start from ->conduit_state_change(), or from
pcs_config() when the conduit is already up, and stop when the conduit
goes down.
> diff --git a/drivers/net/dsa/realtek/rtl8365mb_main.c b/drivers/net/dsa/realtek/rtl8365mb_main.c
> index a8e9220b217fd..a1155a75356da 100644
> --- a/drivers/net/dsa/realtek/rtl8365mb_main.c
> +++ b/drivers/net/dsa/realtek/rtl8365mb_main.c
[ ... ]
> @@ -1670,8 +1774,184 @@ static int rtl8365mb_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
[ ... ]
> + /* The re-latch edge has only been observed with HSGMII, so the work is
> + * only armed for 2500base-x. It starts once the conduit is up.
> + */
> + if (is_d) {
> + WRITE_ONCE(mb->sds_relatch_armed,
> + interface == PHY_INTERFACE_MODE_2500BASEX);
> + /* With the conduit already up no conduit_state_change() will
> + * follow, so start the episode here.
> + */
> + if (READ_ONCE(mb->sds_relatch_armed) &&
> + READ_ONCE(mb->sds_conduit_up))
> + rtl8365mb_sds_relatch_start(mb);
> + }
> +
> + return 0;
> +}
> +
> +static void rtl8365mb_conduit_state_change(struct dsa_switch *ds,
> + const struct net_device *conduit,
> + bool operational)
> +{
> + struct realtek_priv *priv = ds->priv;
> + struct rtl8365mb *mb = priv->chip_data;
> +
> + if (rtl8365mb_get_family(priv) != RTL8365MB_FAMILY_D)
> + return;
> +
> + guard(mutex)(&mb->sds_cfg_lock);
> +
> + WRITE_ONCE(mb->sds_conduit_up, operational);
> + cancel_delayed_work_sync(&mb->sds_relatch);
> + if (operational && READ_ONCE(mb->sds_relatch_armed))
> + rtl8365mb_sds_relatch_start(mb);
> +}
[Severity: Medium]
Should rtl8365mb_conduit_state_change() check which conduit the event is
for? It never uses the conduit argument. As a result, every conduit in
the tree overwrites the single sds_conduit_up flag, and each one cancels
or restarts the one SerDes work item.
dsa_switch_conduit_state_change() in net/dsa/switch.c passes on every
conduit's state without filtering:
ds->ops->conduit_state_change(ds, info->conduit, info->operational);
rtl8365mb_setup() also accepts more than one CPU port:
dsa_switch_for_each_cpu_port(dp, ds) {
/* Use the first CPU port as trap_port */
if (cpu->trap_port == RTL8365MB_MAX_NUM_PORTS)
cpu->trap_port = dp->index;
The RTL8367S-VB, added later in the series, allows port 6 (EXT0, SerDes)
and port 7 (EXT1, RGMII) to both be CPU ports. Suppose the RGMII conduit
goes down while the SerDes conduit stays up. Would that cancel the
SerDes work and leave sds_conduit_up false? A SerDes that has not
latched yet, or that loses its link later, would then stay in the "link
up, no frames" state.
A later pcs_config() would not restart the work either, because it reads
the cached flag.
The reverse case looks affected too. If the RGMII conduit comes up while
the SerDes conduit is down, park/restore episodes would start against a
far end that is not running.
rtl8365mb_pcs_config() above raises a related question.
rtl8365mb_phylink_mac_select_pcs() returns the shared PCS for any port
in a SerDes mode:
if (rtl8365mb_interface_is_serdes(interface))
return &mb->pcs;
rtl8365mb_pcs_config() then sets sds_relatch_armed for any 2500base-x
user, with no dsa_port_is_cpu() check. Suppose port 6 is a 2500base-x
user port (SFP or 2.5G PHY). Could any CPU conduit coming up start an
episode on it?
If so, whenever that user link is down (after a cable pull, for
example), SDS_MISC would be parked for 20 ms every 1 s for 15 tries,
then every 10 s. The "did not latch" and "link lost outside a
reconfiguration" warnings would be logged each time.
Other implementers of this op filter on the conduit. For example,
qca8k_conduit_change() does:
struct dsa_port *dp = conduit->dsa_ptr;
...
if (dp->index != 0)
return;
Would a similar check here, limited to the CPU port that owns the
SerDes, avoid both cases?
[ ... ]
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/5a4715dd-89e0-4868-9ffb-c8fb73b18d04%40yahoo.com
Technical Details
Message-ID:
<179246049030.3135.13023954288671040078@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348960-linux-kernel-netdev=dewy.ruReferences:
<c43a5bf1-0cf9-4c68-b905-e9b615e2c9b2@yahoo.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348960-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v6 8/9] net: dsa: realtek: rtl8365mb: re-latch the family D SerDes Date: Tue, 20 Oct 2026 01:41:30 +0000 Organization: Usenet Network Message-ID: <179246049030.3135.13023954288671040078@kernel.org> References: <c43a5bf1-0cf9-4c68-b905-e9b615e2c9b2@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3759672"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:DWYmH4qHiSIKzwscMdhU7EKshGE= sha256:mYWJZRSHRulegN6+yWzbcyU4Khc4/kh6bRnkpXocb7Q= sha1:RIY/WDLtCMuGHXnbqzYS2lxO5l0= sha256:yTbw5JJ3lll+avU64H7JqJY/TBj8NireQw1DTn/kQoc= 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 9323F110BB0; Tue, 20 Oct 2026 04:43:56 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.728 X-Spam-Status: No, score=-3.728 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.329, 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 NmuAg9uzJ_7K; Tue, 20 Oct 2026 04:43:53 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-348960-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 16E20110B62; Tue, 20 Oct 2026 04:43:45 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id F074160E48; Tue, 20 Oct 2026 01:41:32 +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=1792460492; b=n3FBLtocvuTQrlT8t92OaNSFx5tpSvnqxPLVNfDVbf1xNvxiqxE2o5xZfC7yJt6Inn1Q NpqXwPprMAc14aOifiwBxQd0GwDJ4yqQDlfGeEX2jWUsnJfwMvB01I3TaawktpM4CU5hy S8+LelTzzCpBJABNzjtW6Eem6wiIM6D09qHff7wkArqOCnTG0zXQVDK4G4Xnu1jFmpV4p CWDxwIMNRj+kInVHrRczj5xxaJGWLXPS1qhmGQeKf+YpuXHNznrPBhOH/9vFUwFnISXUH 2Ar2HkHqIL0Q4eNYma4Ni+qtPk60X+B1yeLDCSjyw6dT2/FqAHJM4Qh7wwGqgCezo9Q== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792460492; 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=aDnrN/rnO8GTJvw/uGicHbUYV95/hlCAICtPYU2nHKk=; b=fh8itIhyvy8IClvtVpLXd6x0odLMvCNLL09+Wr0ud84S+macSDU9LJbUYWPLrFTUTafo UnMczJLmnv+kQ7cO4hcpvQy1kZecvMiknctN5LWyLXlpiCQdQNoxRB2jghiOYMpcubNJk 9Sib+LGR4bdt972vsUUsjxn0G5wa7X8uwwQPn+IjiHoXsRuupwatlF34lnRZWI44CAYyN iqC7Uiu/llHVmzQs6o6RK69dEJBqylorbNbxuHQAzDq3WzB73/8/4yv4fMRe1CeOdMxF1 rNhQcPLNJYnYtlzhG/tK3WPH5bA3pwzS/J+zfI8YhJSBeySQ4VBqTAkX+W5K2cYK2Jg== 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=OEGECTr6; 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 C2376606A335; Tue, 20 Oct 2026 01:41:32 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=OEGECTr6 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=1792460492; b=wdiR8UkvZcWbE/6Q0sa5IIkGtqA0WUFKLIN6WXn8W1yIQoiWY13pGTJYW4647Q7y74ez LTPqPU12uTYDvMWT/IUxATTWM/HB/l9rpq/OjSKbXeF01JiWFXSr+9n9pH5RvLvGTSpzX OxECSS8z/Pdva2aAf3EP7RAGQWWpwLSKx901XlnbPl5q+b05qIX3o41OgiHGVxt2uQ6hl FO2U2T6Mzzf/nCDoQt8omhDlIwAkaGaJr3xtTFzqVWz1hlxD6oRq2pKHjDmYwv/HrpDi4 liFskIQu7rQW+iWWQeZTro+w0dMlez4yppI7+X4QXVADuyl5EU5/0+wV4b2Ot7wBWoQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792460492; 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=aDnrN/rnO8GTJvw/uGicHbUYV95/hlCAICtPYU2nHKk=; b=RZAPYybVX1BUTCSortI6fjOV6EF2DIL6nDqnMoRWnizry0jQTnBQs6++cGU4Ndq1/3t/ i2zLKAV1rtEbhNSyO/HXMJDVVnpIgj9Q6wrQ/3mi+gSu8XYAYophw8UKndfxLZ/xMv0rP hKn1y5SaczaZN64s8eNd6GLRrOuN1KYMFI1P/lGNPGFyNb/skKIe+5Q3mWQbDoYQczkMm tHqKHtnlUVTkwTt2U3vVql5SLe7v3aFNXnOMAvzXnBfhFR/fTCm/lL2uKnsIYyBliOtlL i2x+mWsP1RliK3Oie3eAQZID1oEH7W2B8akoLjdB5Rda/EvdFEnj1wJnpn53Z0q3xPQ== 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=OEGECTr6; 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 A372B606A328; Tue, 20 Oct 2026 01:41:31 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0DF01F000C7; Tue, 20 Oct 2026 01:41:30 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792460491; bh=aDnrN/rnO8GTJvw/uGicHbUYV95/hlCAICtPYU2nHKk=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=OEGECTr6MHjApaNaS5+l2ymKg3u8HTBL/7GV3C5c5WJoQ8MW7IsR0A2qF4yZGzorC dcK2MbWcgiTqwiZXIxc7HCCn47o/YGI+bvhRKoRgrU1TyJbODxLwZkp4uivelC9TvX PIU0j4E0VOPC5RhEiFdCPTWwlvQVGe2wocxgB5UZ/9KmxYFYWOZMn9KfyNvUx758JN MuWCjWiAAzBYtv+tf1opGvqVyzjvNx5tWyA2mFq9BHxZp/j4yHYqgujNuqM/j1YEJL vUzs7/lj17u4rKMi3rjBdQGhfSLDK+t6h68T54F6H+CPwKMuj99U1bF70Um4foADHH rHUW5sx9y+Yng== X-Cc: linusw@kernel.org, andrew@lunn.ch, olteanv@gmail.com, kuba@kernel.org, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, linux@armlinux.org.uk, luizluca@gmail.com, maxime.chevallier@bootlin.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <c43a5bf1-0cf9-4c68-b905-e9b615e2c9b2@yahoo.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