Re: [PATCH net-next v12 10/13] net: dsa: realtek: rtl8365mb: add family D SDS13 PCS support

From: netdev-bot+sashiko

Date: Mon Nov 23 2026 - 20:24:49 EST


Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 2

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_phylink_mac_link_up() now skips the SerDes-side
pause programming (RTL8365MB_SDS_MISC_REG 0x1D11, SGMII_TXFC BIT(13) /…
- [Low] On family D, rtl8365mb_pcs_config() in
drivers/net/dsa/realtek/rtl8365mb_main.c now wraps the external…
- [Low] On family D, rtl8365mb_sds_probe_option() returns early with
mb->sds_supported = true (line 1468).

--

net: dsa: realtek: rtl8365mb: add family D SDS13 PCS support

This extends the existing RTL8367S SGMII/HSGMII PCS code to family D
switches. On family D the CPU SerDes is reached through the indexed SDS13
window, and the family D SDS_MISC layout and tuning tables come from the
vendor RTL8367D API. On family D the patch also skips the pcs_link_up()
forcing and the SerDes pause programming, and stops advertising 10/100 on
the SerDes port.

> diff --git a/drivers/net/dsa/realtek/rtl8365mb_main.c b/drivers/net/dsa/realtek/rtl8365mb_main.c
> index 7ad9ef1cbab7d..50ba2fa465808 100644
> --- a/drivers/net/dsa/realtek/rtl8365mb_main.c
> +++ b/drivers/net/dsa/realtek/rtl8365mb_main.c

[ ... ]

> @@ -1418,6 +1461,14 @@ static int rtl8365mb_sds_probe_option(struct realtek_priv *priv)
> int ret;
> int i;
>
> + /* Family D has a fixed SDS13 programming model and does not use the
> + * family C option register to select its tuning table.
> + */
> + if (rtl8365mb_is_d(priv)) {
> + mb->sds_supported = true;
> + return 0;
> + }
> +

[Severity: Low]
Since sds_supported is now always true on family D, rtl8365mb_setup()
will always call rtl8365mb_sds_raise_rate_limits() on these chips:

drivers/net/dsa/realtek/rtl8365mb_main.c:rtl8365mb_setup() {
...
if (mb->sds_supported) {
ret = rtl8365mb_sds_raise_rate_limits(priv);
...
}

That function writes 0xFFFF to 0x00CF and 0x0398, and sets GENMASK(2, 0)
in 0x00D0 and 0x0399. These are the family C port 6 ingress/egress limiter
addresses, with the family C 3-bit MSB field layout.

The commit message checks the BYPASS_LINE_RATE (0x03f7) layout against the
RTL8367D vendor definitions. It doesn't do the same for these four
registers. The comment above rtl8365mb_sds_raise_rate_limits() says the
vendor driver raises them "for the whole chip family", and that appears to
mean family C.

In this series family D already differs from family C in several other
register blocks: the per-port force registers, the 3-bit speed field, the
VLAN 4k format, PVID and the LUT.

Do the port 6 rate limiter registers have the same addresses and field
widths on the RTL8367D? If they don't, could these writes set bits in
registers the driver doesn't mean to touch?

> /* Nothing to probe if no external interface is wired to the SerDes */
> for (i = 0; i < RTL8365MB_MAX_NUM_EXTINTS; i++) {
> extint = &mb->chip_info->extints[i];

[ ... ]

> @@ -1546,34 +1620,58 @@ static int rtl8365mb_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,

[ ... ]

> - val = mode << RTL8365MB_DIGITAL_INTERFACE_SELECT_MODE_OFFSET(id);
> - ret = regmap_update_bits(priv->map,
> - RTL8365MB_DIGITAL_INTERFACE_SELECT_REG(id),
> - RTL8365MB_DIGITAL_INTERFACE_SELECT_MODE_MASK(id),
> - val);
> - if (ret)
> - return ret;
> + if (!is_d) {
> + val = sds_mode << RTL8365MB_DIGITAL_INTERFACE_SELECT_MODE_OFFSET(id);
> + ret = regmap_update_bits(priv->map,
> + RTL8365MB_DIGITAL_INTERFACE_SELECT_REG(id),
> + RTL8365MB_DIGITAL_INTERFACE_SELECT_MODE_MASK(id),
> + val);
> + if (ret)
> + return ret;
> + }
>
> /* Take the SerDes out of reset. The vendor driver does this only
> * after the SerDes mux and the interface mode are configured.
> */

[Severity: Low]
This isn't a functional bug as far as the testing shows. On family D the
DIGITAL_INTERFACE_SELECT mode write in rtl8365mb_pcs_config() is now
skipped, and nothing equivalent is written for ext0 (MAC6). Does the
RTL8367D vendor sequence leave out this step on purpose? For example, does
SDS_MISC[4:0] (0x02/0x12) alone select SGMII/HSGMII?

The commit message only says that the SDS13 window and the SDS_MISC fields
differ. The comment just below still says the interface mode is configured
before the reset is deasserted.

Could a short comment or a sentence in the commit message explain why
family D doesn't need an interface mode select write here?

[ ... ]

> @@ -2087,18 +2231,21 @@ static void rtl8365mb_phylink_mac_link_up(struct phylink_config *config,
> return;
> }
>
> - /* The SerDes has its own pause enables; program them from
> - * the resolved pause modes, as the vendor driver does when
> - * forcing the link on a SerDes external interface. These
> - * bits, not the MAC force pause bits, gate pause on the
> - * SerDes external interface: flow control testing shows
> - * that pause frames are only emitted with the SerDes TXFC
> - * bit set, while the MAC force pause bits alone have no
> - * effect on this port. This is done here rather than in
> - * rtl8365mb_pcs_link_up() because pcs_link_up() carries no
> - * pause information.
> + /* Family C: the SerDes has its own pause enables; program
> + * them from the resolved pause modes, as the vendor driver
> + * does when forcing the link on a SerDes external
> + * interface. These bits, not the MAC force pause bits, gate
> + * pause on the SerDes external interface: flow control
> + * testing shows that pause frames are only emitted with the
> + * SerDes TXFC bit set, while the MAC force pause bits alone
> + * have no effect on this port. This is done here rather
> + * than in rtl8365mb_pcs_link_up() because pcs_link_up()
> + * carries no pause information. Family D does not use this
> + * path: its pause bits are set in the forced-mode register
> + * by rtl8365mb_d_ext_config_forcemode().
> */
> - if (rtl8365mb_interface_is_serdes(interface)) {
> + if (rtl8365mb_interface_is_serdes(interface) &&
> + !rtl8365mb_is_d(priv)) {

[Severity: Medium]
Does flow control still work on the family D SerDes port after this
change?

The comment records a measured family C result. On the SerDes external
interface, the MAC force pause bits alone have no effect, and pause frames
are only sent when the SerDes TXFC bit is set.

On family D, mac_link_up() now skips the SDS_MISC TXFC/RXFC programming.
It relies only on the TXPAUSE/RXPAUSE bits that
rtl8365mb_d_ext_config_forcemode() writes to the MAC force register.

The family D SDS_MISC update in rtl8365mb_pcs_config() only touches
RTL8365MB_D_SDS_MISC_CFG_MASK (bits 11, 10, 9 and 4:0). Any SerDes-side
flow control gate on family D would therefore keep its reset value.

Is there an RTL8367D vendor API reference, or a flow control test, showing
that family D has no similar SerDes pause gate? The commit message only
mentions link testing at 1G SGMII and 2500base-x.

If such a gate does exist, phylink and ethtool would report tx/rx pause as
active on port 6 while the hardware never sends or honours pause frames.

> u32 val = 0;
>
> if (tx_pause)

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/bc42ae96-dc7e-4b6e-b9cc-64cde5dc51ce%40yahoo.com