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

From: netdev-bot+sashiko

Date: Thu Nov 26 2026 - 22:01:28 EST


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, rtl8365mb_setup() sets ds->max_num_bridges = 1
(drivers/net/dsa/realtek/rtl8365mb_main.c:3859) and treats it as a…

--

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

This patch teaches the rtl8365mb table and L2 code about the family D
(RTL8367S-VB) LUT layout. It also uses port-based FID to isolate an
offloaded VLAN-unaware bridge in FID 1 from standalone ports in FID 0.
On family D, fdb_isolation is no longer advertised and max_num_bridges is
set to 1.

> diff --git a/drivers/net/dsa/realtek/rtl8365mb_main.c b/drivers/net/dsa/realtek/rtl8365mb_main.c
> index cf06bc94c6029..bf508edc1ad96 100644
> --- a/drivers/net/dsa/realtek/rtl8365mb_main.c
> +++ b/drivers/net/dsa/realtek/rtl8365mb_main.c

[ ... ]

> @@ -3670,9 +3841,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 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).
> + */
> + ds->max_num_bridges = 1;

[Severity: Medium]
Does max_num_bridges = 1 actually mean "at most one offloaded bridge" on
this switch?

DSA treats max_num_bridges as an upper bound on bridge numbers, and those
numbers come from a single system-wide bitmap:

net/dsa/dsa.c:dsa_bridge_num_get() {
...
if (!bridge_num) {
bridge_num = find_next_zero_bit(&dsa_fwd_offloading_bridges,
DSA_MAX_NUM_OFFLOADING_BRIDGES,
1);
if (bridge_num > max)
return 0;
...
}

If it returns 0, dsa_port_bridge_create() fails with "Range of offloadable
bridges exceeded" and -EOPNOTSUPP, and dsa_user_changeupper() falls back
to software bridging.

Here is one case. Another DSA switch in a different tree already offloads
a bridge holding bridge number 1. A new bridge built only from
RTL8367S-VB ports then gets number 2. Since 2 > 1, it is refused, and this
switch cannot offload any bridge at all, so all bridged traffic goes
through the CPU.

Whether offload works then depends on the order in which unrelated
switches allocated numbers. It can also change as bridges are deleted and
their numbers freed.

The comment above, and this part of the commit message, describe only the
opposite outcome of the same mismatch:

DSA allocates bridge numbers system-wide, 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, a known limitation.

rtl83xx_port_bridge_join() passes any non-zero bridge.num to
port_set_efid(), which maps it to FID 1 on family D. It does not enforce
the one-bridge-per-switch limit itself.

Would it work better to keep max_num_bridges at a larger value? On family
D, port_bridge_join could then return -EOPNOTSUPP when another port of
this switch already offloads a different bridge, which would avoid both
outcomes.

At minimum, could the comment and the commit message say that on
multi-switch systems this switch may be unable to offload any bridge?

This code is unchanged at the end of the series, in "net: dsa: realtek:
rtl8365mb: add support for RTL8367S-VB".

> + }
>
> ds->configure_vlan_while_not_filtering = true;
>

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/874b29a3-f47f-4bf2-a0f6-2f9fea712f4c%40yahoo.com