From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DC421F00A27; Mon, 30 Nov 2026 15:12:49 +0000 (UTC) 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== Subject: Re: [PATCH net-next v16 12/15] net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D 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, alvin.sipraga@analog.com, gusfmora@gmail.com, kuncy7@gmail.com, fabianotassotti@gmail.com, gabonpivovich@gmail.com, contact@c127.dev, o.rempel@pengutronix.de Date: Mon, 30 Nov 2026 15:12:48 +0000 Message-ID: <179605156893.3146.2928663403676847633@kernel.org> In-Reply-To: <3a5154a4-2b98-4658-916e-92817e04f352@yahoo.com> References: <3a5154a4-2b98-4658-916e-92817e04f352@yahoo.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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