Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by netdev-bot+sashiko
Tue, 01 Dec 2026 21:22
Re: [PATCH net-next v17 12/15] net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D
Author: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 21:22
Date: Tue, 01 Dec 2026 21:22
209 lines
15956 bytes
15956 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads