From: netdev-bot+sashiko@kernel.org
To: namiltd@yahoo.com
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
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 [thread overview]
Message-ID: <179246049030.3135.13023954288671040078@kernel.org> (raw)
In-Reply-To: <c43a5bf1-0cf9-4c68-b905-e9b615e2c9b2@yahoo.com>
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
next prev parent reply other threads:[~2026-10-20 1:41 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <5a4715dd-89e0-4868-9ffb-c8fb73b18d04.ref@yahoo.com>
2026-10-16 0:59 ` [PATCH net-next v6 0/9] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-10-16 1:01 ` [PATCH net-next v6 1/9] dt-bindings: net: dsa: realtek: add RTL8367S-VB Mieczyslaw Nalewaj
2026-10-16 13:50 ` Luiz Angelo Daros de Luca
2026-10-16 1:02 ` [PATCH net-next v6 2/9] net: dsa: realtek: rtl8365mb: add chip family infrastructure Mieczyslaw Nalewaj
2026-10-16 13:53 ` Luiz Angelo Daros de Luca
2026-10-16 1:03 ` [PATCH net-next v6 3/9] net: dsa: realtek: rtl8365mb: set speed for family D Mieczyslaw Nalewaj
2026-10-16 20:04 ` Linus Walleij
2026-10-18 22:40 ` Luiz Angelo Daros de Luca
2026-10-18 23:04 ` Andrew Lunn
2026-10-19 8:28 ` Linus Walleij
2026-10-20 1:41 ` netdev-bot+sashiko
2026-10-16 1:04 ` [PATCH net-next v6 4/9] net: dsa: realtek: rtl8365mb: set RGMII mode " Mieczyslaw Nalewaj
2026-10-16 20:06 ` Linus Walleij
2026-10-20 1:41 ` netdev-bot+sashiko
2026-10-16 1:05 ` [PATCH net-next v6 5/9] net: dsa: realtek: rtl8365mb: set and get vlan 4k " Mieczyslaw Nalewaj
2026-10-16 20:06 ` Linus Walleij
2026-10-16 1:06 ` [PATCH net-next v6 6/9] net: dsa: realtek: rtl8365mb: use raw VID for PVID on " Mieczyslaw Nalewaj
2026-10-16 20:08 ` Linus Walleij
2026-10-16 1:07 ` [PATCH net-next v6 7/9] net: dsa: realtek: rtl8365mb: add family D SDS13 PCS support Mieczyslaw Nalewaj
2026-10-16 20:14 ` Linus Walleij
2026-10-16 1:08 ` [PATCH net-next v6 8/9] net: dsa: realtek: rtl8365mb: re-latch the family D SerDes Mieczyslaw Nalewaj
2026-10-16 20:17 ` Linus Walleij
2026-10-20 1:41 ` netdev-bot+sashiko [this message]
2026-10-16 1:09 ` [PATCH net-next v6 9/9] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-10-16 20:17 ` Linus Walleij
2026-10-20 1:41 ` netdev-bot+sashiko
2026-10-17 10:59 ` [PATCH net-next v6 0/9] " Stanislaw Pal
2026-10-19 2:44 ` Luiz Angelo Daros de Luca
2026-10-19 5:09 ` Mieczyslaw Nalewaj
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=179246049030.3135.13023954288671040078@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=luizluca@gmail.com \
--cc=maxime.chevallier@bootlin.com \
--cc=namiltd@yahoo.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
/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