🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24659

Re: [PATCH net-next v16 12/15] net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D

#24659
From: netdev-bot+sashiko
Date: Mon, 30 Nov 2026 15:12
136 lines
13479 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] On family D (RTL8367S-VB), rtl8365mb_port_set_efid()
  (drivers/net/dsa/realtek/rtl8365mb_main.c) treats any non-zero bridge…

--

net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D

This commit teaches the rtl8365mb table and L2 code about the family D
(RTL8367S-VB) LUT layout and table access interface. It also uses
port-based FID 1 for offloaded VLAN-unaware bridge ports, enables the
lookup-hit isolation fallback and sets max_num_bridges to 1 on family D.

Closes: https://github.com/openwrt/openwrt/pull/19644#issuecomment-6708118180

> diff --git a/drivers/net/dsa/realtek/rtl8365mb_main.c b/drivers/net/dsa/realtek/rtl8365mb_main.c
> index 45c1f0d90eae9..fc38bd12b62b7 100644
> --- a/drivers/net/dsa/realtek/rtl8365mb_main.c
> +++ b/drivers/net/dsa/realtek/rtl8365mb_main.c

[ ... ]

> @@ -2736,6 +2818,46 @@ static int rtl8365mb_port_pre_bridge_flags(struct dsa_switch *ds, int port,
>  static int rtl8365mb_port_set_efid(struct realtek_priv *priv, int port,
>  				   u32 efid)
>  {
> +	/* Family D has no EFID (0x0A32 is RTL8365MB_D_LUT_CFG2_REG). Instead,
> +	 * assign port-based FID 1 to offloaded VLAN-unaware bridge ports
> +	 * (efid != 0 and !vlan_filtering) so their SVL entries do not collide
> +	 * with standalone ports in FID 0.
> +	 */
> +	if (rtl8365mb_is_d(priv)) {
> +		struct dsa_port *dp = dsa_to_port(&priv->ds, port);
> +		bool enable = efid && !dsa_port_is_vlan_filtering(dp);
> +		u8 fid = enable ? RTL8365MB_D_UNAWARE_BRIDGE_FID : 0;

[Severity: Medium]
Can two different offloaded bridges end up sharing FID 1 here? Every
non-zero efid is mapped to RTL8365MB_D_UNAWARE_BRIDGE_FID. The family D L2
key built by rtl8365mb_d_l2_uc_to_data() and rtl8365mb_d_l2_mc_to_data()
also has no per-bridge part.

Setting max_num_bridges = 1 does not seem to stop a second bridge from
being offloaded. dsa_bridge_num_get() returns an existing system-wide
number without comparing it to max:

net/dsa/dsa.c:dsa_bridge_num_get() {
	unsigned int bridge_num = dsa_bridge_num_find(bridge_dev);
	...
	if (!bridge_num) {
		...
		if (bridge_num > max)
			return 0;
		...
	}

	return bridge_num;
}

dsa_port_bridge_create() only rejects a zero result. Suppose a bridge
already got number 2 from a switch in another DSA tree. It is accepted
here, and this call gives the port PBFID 1:

rtl83xx_port_bridge_join()->rtl8365mb_port_set_efid(priv, port, 2)

The local bridge with number 1 uses that same FID.

In that setup, a host on bridge B can send frames with the source MAC of a
host M on bridge A. Would that move M's learned entry in FID 1 to B's port?
Static entries for the same MAC in both bridges would also overwrite each
other.

rtl8365mb_d_lut_init() sets RTL8365MB_D_LUT_LOOKUP_HIT_ISO_ACT. Traffic
from A's ports to M would then hit a port outside A's isolation mask. It
would be flooded to A's whole isolation mask, including the CPU, instead of
going to a single port.

The commit message and the comment in rtl8365mb_setup() call this a known
limitation. Could the driver refuse the offload instead, for example by
returning -EOPNOTSUPP from the bridge join path when another bridge on this
switch already uses PBFID 1? Another option is distinct PBFIDs, since
RTL8365MB_D_PORT_PBFID_MASK is 2 bits wide. Either way, software forwarding
would keep the bridges isolated.

> +		int ret;
> +
> +		/* PBFID is ignored while PBFIDEN is clear, so write them in
> +		 * the order that leaves the port usable if the second write
> +		 * fails: PBFID first when enabling, PBFIDEN first when
> +		 * disabling.
> +		 */

[ ... ]

> @@ -3705,9 +3874,25 @@ static int rtl8365mb_setup(struct dsa_switch *ds)
>  		goto out_teardown_irq;
>  
>  	ds->assisted_learning_on_cpu_port = true;
> -	ds->fdb_isolation = true;
> -	/* The EFID is 3 bits, but EFID 0 is reserved for standalone ports */
> -	ds->max_num_bridges = FIELD_MAX(RTL8365MB_EFID_MASK);
> +	if (!rtl8365mb_is_d(priv)) {
> +		ds->fdb_isolation = true;
> +		/* The EFID is 3 bits, but EFID 0 is reserved for standalone */
> +		ds->max_num_bridges = FIELD_MAX(RTL8365MB_EFID_MASK);
> +	} else {
> +		/* No EFID; FID 0 is used by standalone ports and FID 1 by the
> +		 * offloaded VLAN-unaware bridge via port-based FID, so allow
> +		 * at most one offloaded bridge. The bridge number it gets is
> +		 * what rtl8365mb_port_set_efid() takes as "offloaded" to
> +		 * enable port-based FID, so max_num_bridges must not be 0.
> +		 * Bridge numbers are allocated system-wide by DSA, so this
> +		 * does not stop a bridge that already has a number from
> +		 * another switch from being offloaded here as well; such
> +		 * bridges share FID 1 (known limitation). If bridge number 1
> +		 * is already used elsewhere, a new local bridge remains
> +		 * software-forwarded.
> +		 */
> +		ds->max_num_bridges = 1;
> +	}

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/aebcc7f6-d5f8-4157-b63a-e2e707d9859b%40yahoo.com
Technical Details
Message-ID: <179605156893.3146.2928663403676847633@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374266-linux-kernel-netdev=dewy.ru
References: <3a5154a4-2b98-4658-916e-92817e04f352@yahoo.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374266-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v16 12/15] net: dsa: realtek: rtl8365mb: make
 L2/LUT access work on family D
Date: Mon, 30 Nov 2026 15:12:48 +0000
Organization: Usenet Network
Message-ID: <179605156893.3146.2928663403676847633@kernel.org>
References: <3a5154a4-2b98-4658-916e-92817e04f352@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1454136"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:RrxUlRw0MtuDSt0xJZKh91LI8e0= sha256:uMj52yEW45faZOg9PrjZOEckmylCThuSZZ3ISkDnoVI=
	sha1:i9yEAX7KdBkQRzIQjbC0tjpPFEE= sha256:ikUoZdjYFDIx0LLasXpAkyaNHveU5ATizeYY/Bm/Law=
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 05F2A125FF1; Mon, 30 Nov 2026 18:14:27 +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 w0EAgTMRg3sA;
	Mon, 30 Nov 2026 18:14:23 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374266-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 50F92125FED; Mon, 30 Nov 2026 18:14:15 +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 967193346A; Mon, 30 Nov 2026 15:13:00 +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=1796051576;
	b=t7axhqNzuFxCCRonG8v/4BxMnfl0i3R6P05lmeDTLh4MTH9VrMvDRAKl9jXMvYub9sqa
	 etNLDhrkXCN7896ND18a4Eobxbqbr0WR/WNSuH+ipyJEGgQ/xme+UnThAQv73GejEawy8
	 ZKZ07h+VcGQ1cDnKewn+0uDn5gfBGpEtiKWa1qpIpOYCr4/VwuSGhvzT/mTVKYOI3NjXf
	 L4/gT3XEXyKuBNjZHjMFiwuB/sFzLM/qtNqQkz7xX44HVL43nGD04/MdbfVfsDiAomS4v
	 CQhc40JkPiuftboW9DqAFlcGpZdsx2KZxvJaVPVZ1FOwTUe75KyVFwPTUUrXO4h44lA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796051576;
	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=xvnJQQHbRoT6tvfZmBBt8R3B0DtBLT644Bp9Fd1Goto=;
	b=20eN/xf2bWpCEAkIUQCG3rRqGrFFD0zLa+zuRO32cP4PbmJoU/EoheHhvgL56m0mo6zl
	 dsL7lAAjseWzuK7c+Z/qQtTLE1mKq9RNQq2L8oCNgFHXUKhMg5qhwmSgBs6Yp12GzJEmq
	 IGhsdFCGWAWTTHGQvH1SUnIYEyW17hrIKlvCz5we/tof4OchmcP/x2MaD4FdFwPSvc8ud
	 BagiYejDffDxadprs+7hiepVvu6IAGVqX3XnU5/ppVsZEmSBZ62+O1Ijq+BeZVO1tu4Im
	 F8ryZwqpZciLKgeGqDgg2PDueWqTmgGIQWs+BytEpXjcseBOwUguQjn3wYmtMvZ6DTg==
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=BY8np8jf;
	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 CA722606A33F;
	Mon, 30 Nov 2026 15:12:56 +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=BY8np8jf
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=1796051571;
	b=EN84jXNR6rSLWlDW7Yih7R4CPT6wwMEoLCcGop54HHQ2pHDymdJc7ym3pPJIw04jSJVK
	 4ZjsOfjhQD7OIpCjtv/3OumIGhDDfv5/+eEHNEiRW7oIqG6DsGTPWB2mSuCkKVYDm4YMH
	 EZAqebaBHqQg6GCAV3ao9ptiMVWuD0/zgWTy7Ri1XgRTv5RB+PYX+eDaBVoasuxpro+GJ
	 jfNRawe6u56X5H0TZCBtJ564/hCIFK45kFi9AXRzKGuXXWAOerQSwui2kkdicudv2ZTsZ
	 xqC6+tx0X2J57AORg6cPDDLLRosj+nYY+3tsn0ZydRE7Vz97/XYEVTRgm3bnh0K3rig==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796051571;
	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=xvnJQQHbRoT6tvfZmBBt8R3B0DtBLT644Bp9Fd1Goto=;
	b=o2ewbxy+Eo8+1TWVLz6jNBT/AOBmJxr23Syd6ZuHOGp2dk6IrBQMU1nGJsmlCTGN6GOn
	 AxVEEHFe43Ilsp8fNAO86FiyAlKx3OydTQN73ycbJ2DkbeLU5An9z+nUHSK1FCIgTtsST
	 mTcNka3fDcDynSXtEkdLCyWUd/RvoJCAHkrMGjbN74MAT6H1GJnaL3QjftDMbGHWTr+4v
	 U4V+8Die/izJf08+f+jBBrvU5TUM9dbQSlO7Cw5fkp43GaGQSvcd3NzUub7qGA8luBQ16
	 OFd/TX+7OwPUKQEkXgfosomjuWbZRZp/XZKbnpryeifk7nPpCk38ncmg3xKgH3k6zoA==
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=BY8np8jf;
	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 EC886606A6A0;
	Mon, 30 Nov 2026 15:12:50 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DC421F00A27;
	Mon, 30 Nov 2026 15:12:49 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796051570;
	bh=xvnJQQHbRoT6tvfZmBBt8R3B0DtBLT644Bp9Fd1Goto=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=BY8np8jfZFjTQQHkZ/Y+/4+6XZUwIQqZ0o0zn4MPFCk6Uaon0bDMEbiElC1bIQYBm
	 nhYXubDxqcAyVV/WAkwCYWEhr9S9vHLno3Dqzzn6bs2VvTbDVr3kLqXO8Kz443mCKl
	 ojV+z4Oy/aIQvPtNknNz2/sYyKIHFk8W9sknlErwLzlx+m57S9nnOZwjjvtJ3QlRDI
	 hdQg2k0kTWFw17BaORHfZ3rOAfITSJyJfi2mqcO8l77aAz+zcQPCbun6+jk9zX90jt
	 8qqBgb79nyCvpeZn+SKVZZ4MidxN5ejSzs0j9l2Y2PDNzCs8CgaA6sM7jW64G281Z1
	 ZPrjtIDX/CLQg==
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: <3a5154a4-2b98-4658-916e-92817e04f352@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