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=1796160141; b=0nqV7PYeazVNSihdwDaWgfLC6BwLdQ9RGf5+hnOSYmDBKkSDTI+KgJSBUEHJ5atK7pqi 58hTa3TwndtAZ48nKPL3FEFgN3FInU0qv/TfESYR80OXzxSpi028G1SS2gxTIzuJd1m45 SGgjDIO1OqT9MJIPY2unR/zjNRcYCstn+q2U4WBE/6uTcQb3mOxJNaC7x/h2baws2Z2j6 LwDrtBQgcPUezd50oTaM43VV2zdqiP92imd1LvwHF0BMGBxate39dNQFtYToZ5pATy3W3 DWOzUQa+2YzFLp48+ntZkd9qh2U3BXAtgMigzARO8nmDyAxWDUFbcFKqpYX7QdXd0Ig== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796160141; 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=7f4iaZ+PPXUISIo5+vV3/rO6o0jGoC/5UbQ+uV8MHPc=; b=0qHqxQDuKxHpCyfJOaeJL2mc3dgnO+l+oMLRhnM5SQoo9EhWypjmb25LxfufRh6H96Zd VDbl4/b6pTlJk9aAZAgKactkn6sXltYn4uIoykjAwVZ+Q7pK77HmcgU0cOtyFY8nidqP0 skpjPhPn6lAYLtvCF+vKNGgqjXz0j9u+4Hb0ZQ60Cyf3Jb8TtO3ZCPgwN1o3VoHRbK6WX DDFR+laqxIj1NpHGHBC+4wDlNNzrCNn7aFi9pNeLUH/1sQiXQxI8iCFOLI/EvJ+WRDhCu 4gcHVs5FUTs5LPRDd06PAejw8hPJojjKMWhh/pN4L7p6fTdX7cEi505KxIo1DiLjydA== 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=feZOnMqA; 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 ED054606A332; Tue, 1 Dec 2026 21:22:20 +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=feZOnMqA Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CB601F00893; Tue, 1 Dec 2026 21:22:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796160140; bh=7f4iaZ+PPXUISIo5+vV3/rO6o0jGoC/5UbQ+uV8MHPc=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=feZOnMqA+2xIwqLWZTx5nU5cbKm4ONQFD/h88Cz4N2dmlDqVpCweg81dsz6Cp7Bto 2SKa4FDNcksNiM7xBa95VQeqkScb36TPh5DgXiphYABv1RHnkQRyfcZIYEhOxM/Ahn vKgbicM1d33uQ2aQdzp5QqWpGIREZg31BCWPHgmJNOH4ecdFBCpI9GO/Qx8n8QBE+d NNHMwfKA6s2WEt9gkNQKqvzV1ZCr9jBz3tqSmDZqETGFk8efrWQ5QCaBga3kB89pNE UOgq/V4A4MPYpIflciNAYMn4AayPmbPv7o5xuhaJgzwN/4e1DrKUT2uflgT0bem+b9 ilPfUWXx7DJHQ== Subject: Re: [PATCH net-next v17 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: Tue, 01 Dec 2026 21:22:19 +0000 Message-ID: <179616013922.3146.10969022930919746599@kernel.org> In-Reply-To: <6e1e7c6b-383d-48fa-ad72-b69ce9620f76@yahoo.com> References: <6e1e7c6b-383d-48fa-ad72-b69ce9620f76@yahoo.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-kernel@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 3 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 2 · 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, rtl8365mb_port_set_efid() changes mb->bridge_ports only at the out_update_bridge label, after all… - [Medium] net: dsa: realtek: stale vlan_filtering check in rtl8365mb_port_set_efid() - [Low] In rtl8365mb_setup() (drivers/net/dsa/realtek/rtl8365mb_main.c), the family D comment next to `ds->max_num_bridges = 1` says that "a… -- 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, table access field widths and the missing EFID. On family D it uses port-based FID 1 for an offloaded VLAN-unaware bridge, enables the lookup-hit isolation fallback and sets max_num_bridges to 1. rtl8365mb_port_set_efid() now tracks the active bridge number and port count. 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 f860f36df7147..05e0d5803b58a 100644 > --- a/drivers/net/dsa/realtek/rtl8365mb_main.c > +++ b/drivers/net/dsa/realtek/rtl8365mb_main.c [ ... ] > @@ -2742,6 +2828,69 @@ 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) > { [ ... ] > + if (rtl8365mb_is_d(priv)) { > + struct dsa_port *dp = dsa_to_port(&priv->ds, port); > + struct rtl8365mb *mb = priv->chip_data; > + bool enable; > + u8 fid; > + int ret; > + > + if (efid && mb->bridge_ports && mb->bridge_num != efid) > + return -EOPNOTSUPP; [ ... ] > + ret = regmap_update_bits(priv->map, > + RTL8365MB_D_PORT_PBFIDEN_REG, > + BIT(port), 0); > + if (ret) > + return ret; > + > + ret = regmap_update_bits(priv->map, > + RTL8365MB_D_PORT_PBFID_REG(port), > + RTL8365MB_D_PORT_PBFID_MASK, 0); > + if (ret) > + return ret; > + > +out_update_bridge: > + if (efid) { > + mb->bridge_num = efid; > + mb->bridge_ports++; > + } else if (mb->bridge_ports) { > + mb->bridge_ports--; > + } [Severity: Medium] Is dp->vlan_filtering already up to date when this runs on bridge join? rtl8365mb_port_set_efid() is only called with a non-zero efid from rtl83xx_port_bridge_join(), which runs from DSA_NOTIFIER_BRIDGE_JOIN in dsa_port_bridge_join(). DSA syncs the bridge's VLAN awareness later, in dsa_port_switchdev_sync_attrs(), which runs after switchdev_bridge_port_offload(). This driver sets neither needs_standalone_vlan_filtering nor vlan_filtering_is_global. A standalone port therefore always arrives here with dp->vlan_filtering false. So when a port joins a VLAN-aware bridge, enable is still computed as true. PBFID is set to 1 and PBFIDEN is enabled, and rtl83xx_port_bridge_join() then enables learning on the port. Until rtl8365mb_port_vlan_filtering() is called with vlan_filtering true and clears PBFIDEN again, the port learns in SVL (IVL=0, FID 1). If another port of this switch is already in a VLAN-aware bridge, rtl8365mb_d_vlan_4k_refresh_ivl() sees no change in the switch-wide IVL state and does nothing. Nothing else flushes the entries learned in that window either. They stay in the LUT as FID 1 SVL entries until they age out, although the port now does IVL lookups. Could the decision here use the bridge device instead? For example, br_vlan_enabled(dsa_port_bridge_dev_get(dp)) could work, since dp->bridge is already set when the join notifier runs. Alternatively, should the port's dynamic entries be fast-aged when rtl8365mb_port_vlan_filtering() turns port-based FID off? [Severity: Medium] Can mb->bridge_ports stay too high forever here? If either regmap_update_bits() in the efid == 0 path fails, the function returns before it reaches out_update_bridge, so the count is never decremented. Neither efid == 0 caller retries. rtl83xx_port_bridge_leave() only logs the error: ret = priv->ops->port_set_efid(priv, port, 0); if (ret) dev_err(priv->dev, "failed to clear EFID on port %d: %pe\n", port, ERR_PTR(ret)); By that point, dsa_port_bridge_leave() has already cleared dp->bridge through dsa_port_bridge_destroy(), and it only logs the notifier error. The undo_efid rollback in rtl83xx_port_bridge_join() ignores the return value: undo_efid: if (priv->ops->port_set_efid) priv->ops->port_set_efid(priv, port, 0); DSA does not send DSA_NOTIFIER_BRIDGE_LEAVE after a failed BRIDGE_JOIN, so this undo is the only chance to lower the count. After a single failed write, bridge_num keeps its old value and bridge_ports stays non-zero, even when no port is in that bridge any more. Any later bridge with a different number then hits: if (efid && mb->bridge_ports && mb->bridge_num != efid) return -EOPNOTSUPP; That bridge is then software-forwarded until the driver is rebound. If the PBFIDEN write succeeds and the PBFID write fails, the port is already standalone in hardware but is still counted as a bridge member. bridge_ports is a plain u8 counter, not a per-port mask, so later calls cannot detect or correct the imbalance. Would a per-port bitmask of bridge members avoid this? The same code is still there at the end of the series. > + > + return 0; > + } [ ... ] > @@ -3711,9 +3907,23 @@ 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 a bridge > + * that already has a number from another switch is rejected > + * with -EOPNOTSUPP in rtl8365mb_port_set_efid() and remains > + * software-forwarded. > + */ [Severity: Low] This isn't a bug, but does this comment match the code? rtl8365mb_port_set_efid() only rejects a bridge number when a different bridge is already offloaded on this switch: if (efid && mb->bridge_ports && mb->bridge_num != efid) return -EOPNOTSUPP; When dsa_bridge_num_get() in net/dsa/dsa.c finds a number in another tree through dsa_bridge_num_find(), it returns that number without comparing it to max. Only newly allocated numbers are checked with "if (bridge_num > max)". So a cross-tree bridge that already has a number in 2..N is accepted and offloaded with FID 1 when it is the first bridge on this switch. The comment in rtl8365mb_port_set_efid() and the commit message ("returns -EOPNOTSUPP for any different bridge number") match the code. Only this comment in rtl8365mb_setup() says such bridges are always rejected. The comment is unchanged at the end of the series. > + ds->max_num_bridges = 1; > + } -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/236d002f-5ca5-4f12-bf5b-0ed6442e5c9a%40yahoo.com