๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24658

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

#24658
From: netdev-bot+sashiko
Date: Mon, 30 Nov 2026 15:12
161 lines
14194 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 ยท High: 0 ยท Medium: 1 ยท 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] On family D the SerDes port (port 6, SGMII/2500base-x) still
  advertises MAC_SYM_PAUSE | MAC_ASYM_PAUSE to phylink.
- [Low] In drivers/net/dsa/realtek/rtl8365mb_main.c, two new family D
  definitions name the same SerDes in contradictory ways.

--

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

This commit extends the rtl8365mb SGMII/HSGMII PCS code to family D
switches. On these switches the CPU SerDes is reached through the indexed
SDS13 window, and SDS_MISC has a different layout. It adds family D tuning
tables, an index argument for the SDS indirect accessors, and family D
branches in pcs_config(), pcs_get_state(), pcs_link_up(), get_caps() and
mac_link_up().

> diff --git a/drivers/net/dsa/realtek/rtl8365mb_main.c b/drivers/net/dsa/realtek/rtl8365mb_main.c
> index 7500ea9b3a627..59901e683dca1 100644
> --- a/drivers/net/dsa/realtek/rtl8365mb_main.c
> +++ b/drivers/net/dsa/realtek/rtl8365mb_main.c

[ ... ]

> @@ -334,7 +340,25 @@
>  #define   RTL8365MB_SDS_OPTION_ARM_KEY		0x0249
>  #define RTL8365MB_SDS_OPTION_REG		0x13C1
>  
> +/* Family D uses the SDS13 indirect window for its MAC6 SerDes.
> + * RTL8365MB_SDS_MISC_REG is at the same register address as on family C
> + * in the vendor RTL8367D API, with the bit layout below.
> + */
> +#define RTL8365MB_D_SDS_EXT0_INDEX			13
> +#define RTL8365MB_D_FIBER_CFG2_REG			0x13E8
> +#define   RTL8365MB_D_FIBER_CFG2_RX_DISABLE_MASK	GENMASK(7, 6)
> +#define   RTL8365MB_D_FIBER_CFG2_RX_DISABLE_SDS0	BIT(6)
> +#define RTL8365MB_D_SDS_MISC_PA33PC_EN			BIT(11)
> +#define RTL8365MB_D_SDS_MISC_PA12PC_EN			BIT(10)
> +#define RTL8365MB_D_SDS_MISC_MAC6_SEL_SDS0		BIT(9)

[ ... ]

> @@ -1575,34 +1663,58 @@ static int rtl8365mb_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
>  
>  	/* Tune the SerDes with vendor-prescribed parameters */
>  	for (i = 0; i < sds_jam_size; i++) {
> -		ret = rtl8365mb_sds_write(priv, sds_jam[i].reg,
> -					  sds_jam[i].val);
> +		ret = rtl8365mb_sds_write(priv, sds_index,
> +					  sds_jam[i].reg, sds_jam[i].val);
> +		if (ret)
> +			return ret;
> +	}
> +
> +	/* Family-specific post-tuning configuration */
> +	if (is_d) {
> +		/* The register and field names follow the vendor RTL8367D API,
> +		 * whose SDS numbering differs from the SDS13 window used
> +		 * here. As in the vendor sequence the whole 2-bit field
> +		 * (bits 7:6) is written, so bit 7 is cleared as well.
> +		 */
> +		ret = regmap_update_bits(priv->map, RTL8365MB_D_FIBER_CFG2_REG,
> +					 RTL8365MB_D_FIBER_CFG2_RX_DISABLE_MASK,
> +					 RTL8365MB_D_FIBER_CFG2_RX_DISABLE_SDS0);
>  		if (ret)
>  			return ret;
> +
> +		misc_mask = RTL8365MB_D_SDS_MISC_CFG_MASK;
> +		misc_val  = RTL8365MB_D_SDS_MISC_PA33PC_EN |
> +			    RTL8365MB_D_SDS_MISC_PA12PC_EN |
> +			    RTL8365MB_D_SDS_MISC_MAC6_SEL_SDS0 | sds_mode;

[Severity: Low]

This isn't a bug, but the two new family D names used here seem to
contradict each other:

  - RTL8365MB_D_SDS_MISC_MAC6_SEL_SDS0 (BIT(9) of SDS_MISC) reads as
    muxing MAC6 to SDS0.
  - RTL8365MB_D_FIBER_CFG2_RX_DISABLE_SDS0 (BIT(6) of 0x13E8) reads as
    disabling RX on that same SDS0.

Read literally, rtl8365mb_pcs_config() selects SDS0 for MAC6 and disables
its receiver in the same bring-up sequence.

The comment above says the names follow the vendor RTL8367D API, whose SDS
numbering differs from the SDS13 window. Both macros use the vendor
naming, though, so the comment doesn't explain why they conflict.

Could the definitions be renamed? Or could the comment say which SerDes or
path bit 6 actually disables, for example only the fiber RX path?

[ ... ]

> @@ -1982,10 +2131,17 @@ static void rtl8365mb_phylink_get_caps(struct dsa_switch *ds, int port,
>  	}
>  
>  	if (extint->supported_interfaces & RTL8365MB_PHY_INTERFACE_MODE_SGMII &&
> -	    mb->sds_supported)
> +	    mb->sds_supported) {
>  		__set_bit(PHY_INTERFACE_MODE_SGMII,
>  			  config->supported_interfaces);
>  
> +		/* The SerDes rate is not programmed for 10 and 100 Mbit/s on
> +		 * family D, see rtl8365mb_pcs_link_up().
> +		 */
> +		if (rtl8365mb_is_d(priv))
> +			config->mac_capabilities &= ~(MAC_10 | MAC_100);
> +	}

[Severity: Medium]

On family D, MAC_SYM_PAUSE and MAC_ASYM_PAUSE are still set in
mac_capabilities for the SerDes port. Will pause actually take effect on
that port?

With this patch, rtl8365mb_phylink_mac_link_up() skips the SerDes pause
enables on family D:

    if (rtl8365mb_interface_is_serdes(interface) &&
        !rtl8365mb_is_d(priv)) {
        u32 val = 0;

        if (tx_pause)
            val |= RTL8365MB_SDS_MISC_SGMII_TXFC_MASK;

That leaves only the TXPAUSE/RXPAUSE bits that
rtl8365mb_d_ext_config_forcemode() writes into the MAC force register.

The family C comment in the same function says flow control testing
showed pause frames are only sent when the SerDes TXFC bit is set. It also
says the MAC force pause bits alone have no effect on the SerDes port.

The commit message drops 10 and 100 Mbit/s for the same reason:

  "It is not known whether the SerDes follows that register"

It also says:

  "Flow control on the family D SerDes port has not been tested."

If the family D SerDes behaves like family C, phylink would resolve
tx_pause and rx_pause as enabled and advertise pause to the link partner.
ethtool -a would report pause as on, but no pause frames would be sent.

Should MAC_SYM_PAUSE | MAC_ASYM_PAUSE also be cleared on family D until
flow control on this port has been checked?

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/aebcc7f6-d5f8-4157-b63a-e2e707d9859b%40yahoo.com
Technical Details
Message-ID: <179605156649.3146.10383763580449481811@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.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-374265-linux-kernel-netdev=dewy.ru
References: <d095cf30-6a85-476c-bc7c-febadbda27a2@yahoo.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.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-374265-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v16 10/15] net: dsa: realtek: rtl8365mb: add
 family D SDS13 PCS support
Date: Mon, 30 Nov 2026 15:12:46 +0000
Organization: Usenet Network
Message-ID: <179605156649.3146.10383763580449481811@kernel.org>
References: <d095cf30-6a85-476c-bc7c-febadbda27a2@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1454078"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:cLlW/OyYzVAXiNEyxyMkWMjrk3M= sha256:5LVNNwBvn5p9QAe4QS4OM6NliFRRa1bVUoVx+BxTp6I=
	sha1:GfUDXKVFkGbEBTXXq9JP2v6j7Bs= sha256:zyCbABiy4k7EazFNkoswGl4/uCUuneoNYqxBP+ME1R8=
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 29D79125FF2; Mon, 30 Nov 2026 18:14:19 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, 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] 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 mL-5I5bxhXUO;
	Mon, 30 Nov 2026 18:14:15 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374265-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 CCB94125FF1; Mon, 30 Nov 2026 18:14:05 +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 2709D306BA; Mon, 30 Nov 2026 15:12:57 +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=1796051574;
	b=dcf4plrS0egLtU+NM3FNSD51peCn6hRI9CWPP0HV3uJm7sIv9QgGP5ex3clqNQdYjh+h
	 JtLpYhIwrHyr7bB0YEWE5UHhnA74O7uIpnuFd43dv0Oz1CdpMUPk4yCoexWlCK+GjKbRf
	 dw941ymiJKnoV768zl3D9yw1B6PNRGyRgYc2NQv3LJZUIddOvSYtVGGQ+k+Svsuuvgg9z
	 RGAOoy185s2vmiNWa/pKcDiSRtIDogK5TCp3eMnO5UoIeoXEcUsSOYx0eUh3ZoHtv/G2V
	 O8LZAbxz9QJIpCfAWJOdX8bdxTcTOtPyGphqszHtKjRteRIZYD5Xc6IkQrvK/BPwtKQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796051574;
	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=+U9wfuqVmW1qSkfeNlxjKChieGJ8Gcx4PMYSTerb754=;
	b=rXz05E/G61t8CxKGzUmvJSmmvCfutuRKMbKIcue4ewYePfUGFMGiXgilderl4BjYkPzu
	 S7kQmW4VqR2B54mEVFuxcpDMKJeawwt2lVApUNIyEPNXrFMq3UVnnaowpek32jYggfHF8
	 sKMu/30iCplfh/JbESRBwIXS0B1OprDf8ba+q/hcNoryqg+kD+Yw/kmbF9ZCGZx1ep9o/
	 cO1RwrrK412MM0G9r01AbhTy54kvvAjFkaoURS99Ddgm6G4m2a+X2X8Q+JuSfEDuiujLB
	 jwcGfmQcvIz9OMe247ZZMKLSQPgd2riU9lFBpVVMbqsnkswOCCnhyXlfrHzFEi0A/5w==
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=LxiaP8+n;
	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 0CA43606A6A4;
	Mon, 30 Nov 2026 15:12:54 +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=LxiaP8+n
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=1796051568;
	b=UPJsvXfWQQDZNc5IE9v31rxeeUl2a9iF4c/NlzSQYKMco+XJtAjr5TL5VWy4/pwr6dUn
	 4L4LLfCsMWQhr/tvujufSrHeed3b3bXNqScSyjKJWcLsSVi63cuhInkn7dcTWQ4A7kImf
	 AokQyQLud/nnVwqysSvvoCSuIa7jNRBlJAT+Jh9IVii6fagC5bhvGieumZvAnYZi+xn25
	 t6fF9HMxLYjRtB4LHBBGHk9V9NiZxmR8BLPxG9bFQAlVkGG7rKkOzsaTOJcVl/Wve34bX
	 F1zuqK6bPXHL1nnBi3aff+p7pBvxF5GSeP6Hmreum7czLWWxgDiKIlpQUp8sYg4CeEg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796051568;
	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=+U9wfuqVmW1qSkfeNlxjKChieGJ8Gcx4PMYSTerb754=;
	b=sOkNBKjaVLf+oZtA+puQFatoPQwLmJZ/p4gsEQQ1sVYR16SOcObdfQq2yXJRotN0N4RI
	 FNQZyG/o2s7GxqW7XXQok3GjyvE+1mK4XLH1jusnkbWFkApxa+RwRXB48wiQHZpaSZkVS
	 oSNFpkAkka82a6BTMAHjzPPXOek8rC9T5pPW4AvRP14x9yBUnQmqtg+1RfFCGzuKXD3Zq
	 CRuGNTYjRm2HBLTHudoHWAvME7Q5MxZLVC2w0TDc1E+ehScV9iq7ilDo5NFNa3Qf7t1zl
	 go6dl4dmWf63SQYRu8AKJ4reXjl7JF5y/Jf+Hx6bOsKQwMKYHwTZ1gPmSAb8++pEfSQ==
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=LxiaP8+n;
	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 2D17F606A33C;
	Mon, 30 Nov 2026 15:12:48 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id E82C21F00896;
	Mon, 30 Nov 2026 15:12:46 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796051568;
	bh=+U9wfuqVmW1qSkfeNlxjKChieGJ8Gcx4PMYSTerb754=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=LxiaP8+n9fTFMz4lqXGPamBrG51Y5CiKDXVRtt0kp7YafuAtygD4/0HldxFPU9z2Y
	 qWZmh1x9Txj/JUqUBoXJ1omFKxj0GHkJzTphN3mqjhhtTPkL96Vqxmb9GZX2Iww/AI
	 NiXIszS5lBVE9XG+aT8GXyReBr/nFA663MeknO28CoKaF2gQN+zrez/uov5c2ZuvNk
	 407pih2cTaPjZW1U63fqov+FHT2CxqvZapdprOfNPXaA5ZTZ1b+V/xkaF435+yvKKJ
	 GeRHY0DAqnQApQPdd9g2SeLTZRjIQgkpg2YyAgpA7sEsh8fUzFBM4fn6ON65tvfJw4
	 6dsEFT1zeBj8Q==
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,
 alvin.sipraga@analog.com, gusfmora@gmail.com, kuncy7@gmail.com,
 fabianotassotti@gmail.com, gabonpivovich@gmail.com, contact@c127.dev,
 o.rempel@pengutronix.de
X-In-Reply-To: <d095cf30-6a85-476c-bc7c-febadbda27a2@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