Re: [PATCH net-next v11 07/13] net: dsa: realtek: rtl8365mb: set and get vlan 4k for family D
From: Gustavo Foletto Mora
Date: Tue Nov 17 2026 - 20:48:57 EST
On a TP-Link EX511 v2 (RTL8367S-VB, CPU port 6 over 1G SGMII to an
IPQ5018), on 6.18.44 with v11 applied as is, I tested the live
vlan_filtering toggle this patch now handles. Two user ports were
bridged with the uplink, two others were in network namespaces as
hosts, with loopback cables in between, and the toggle was done with
"ip link set ... type bridge vlan_filtering", without touching the
VLANs:
- 1 -> 0 with the VLAN in place: after a fast age the hosts are learned
without a VID (SVL). A static entry with VID 0 on the ingress port
drops the frames, and on the other bridge port it steers them there
only. A group entry with VID 0 restricts the group. With v10 the VLAN
stayed IVL until its VID was deleted and added again.
- VID deleted and added while not filtering (so it is written SVL),
then 0 -> 1 without touching it: the hosts are learned with the VID
again and unicast with learning on works. A static entry with the VID
on the wrong port replaces the learned one and cuts the traffic, and a
group entry with the VID restricts the group. With v10 the VLAN stayed
SVL in that case.
One thing to note: each toggle that flipped the switch-wide state took
about 5.4 s here (5420, 5450 and 5390 ms for the ip link command),
presumably the scan of all 4K entries over MDIO. Management over the
same bridge stayed up and no warnings were logged, but scanning only the
VIDs in use would make it much shorter.
The rest of the series passes our regression run on this board as with
v10: VLAN-aware and VLAN-unaware bridges, PVIDs, isolation, FDB and MDB
entries, flooding flags, load, no driver warnings or port errors.
Tested-by: Gustavo Foletto Mora <gusfmora@xxxxxxxxx>
Thanks,
Gustavo
Em ter., 17 de nov. de 2026 às 05:23, Linus Walleij
<linusw@xxxxxxxxxx> escreveu:
>
> On Tue, Nov 17, 2026 at 8:39 AM Mieczyslaw Nalewaj <namiltd@xxxxxxxxx> wrote:
>
> > The hardware structure of 4K VLAN table entries has changed between
> > silicon families. Family D's CVLAN entry is two 16-bit words rather
> > than three: there is no third word extending member/untag past bit 7,
> > and no priority/meter fields at all. The FID field is restricted to a
> > narrower 2-bit width. The chip itself supports both IVL and SVL.
> >
> > IVL_EN (bit 3, versus bit 14 on family C) follows vlan4k->ivl_en. On
> > family D, rtl8365mb_vlan_4k_port_set() enables it while any user port
> > has VLAN filtering enabled (dsa_port_is_vlan_filtering()), so that
> > static and learned FDB/MDB entries use the same key. Family C keeps IVL
> > always enabled, as before.
> >
> > When a vlan_filtering change flips this switch-wide state,
> > rtl8365mb_d_vlan_4k_refresh_ivl() updates IVL_EN across the active 4K
> > entries, so existing VLANs, including those programmed before filtering
> > was enabled, switch between SVL and IVL immediately. Changes that leave
> > the state as it is do not touch the table, as the update reads every
> > entry.
> >
> > Reusing the three-word family C layout on family D would read a third
> > word that does not exist as a distinct table word on family D's die.
> > Whatever data happens to be in that register would be folded into
> > member/untag bits [10:8] on read, and written back on every
> > read-modify-write cycle in rtl8365mb_vlan_4k_port_set(). Give family D
> > its own two-word pack/unpack instead: add rtl8365mb_d_vlan_4k_read() and
> > rtl8365mb_d_vlan_4k_write(). The shared code reaches them through the
> > vlan_4k_read and vlan_4k_write pointers in struct rtl8365mb_family_info,
> > so the pack/unpack code needs no is_d() check.
> >
> > The two-word layout matches the vendor switch API for this chip
> > family, which writes only 0x0510/0x0511 for a CVLAN entry.
> >
> > Nothing points to them until the family D info is added together with
> > the chip table entry in the last patch. Until then they are not static
> > and are declared in rtl8365mb_vlan.h, so that the build does not warn
> > about unused functions.
> >
> > Signed-off-by: Mieczyslaw Nalewaj <namiltd@xxxxxxxxx>
>
> Looks Good To Me (TM)
> Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>
>
> Yours,
> Linus Walleij