Thread View: linux.kernel.netdev
3 messages
3 total messages
Started by Linus Walleij
Tue, 17 Nov 2026 08:23
Re: [PATCH net-next v11 07/13] net: dsa: realtek: rtl8365mb: set and get vlan 4k for family D
Author: Linus Walleij
Date: Tue, 17 Nov 2026 08:23
Date: Tue, 17 Nov 2026 08:23
48 lines
11310 bytes
11310 bytes
On Tue, Nov 17, 2026 at 8:39 AM Mieczyslaw Nalewaj <namiltd@yahoo.com> 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@yahoo.com> Looks Good To Me (TM) Reviewed-by: Linus Walleij <linusw@kernel.org> Yours, Linus Walleij
Re: [PATCH net-next v11 07/13] net: dsa: realtek: rtl8365mb: set and get vlan 4k for family D
Author: Gustavo Foletto Mora
Date: Wed, 18 Nov 2026 01:48
Date: Wed, 18 Nov 2026 01:48
88 lines
16161 bytes
16161 bytes
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@gmail.com> Thanks, Gustavo Em ter., 17 de nov. de 2026 às 05:23, Linus Walleij <linusw@kernel.org> escreveu: > > On Tue, Nov 17, 2026 at 8:39 AM Mieczyslaw Nalewaj <namiltd@yahoo.com> 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@yahoo.com> > > Looks Good To Me (TM) > Reviewed-by: Linus Walleij <linusw@kernel.org> > > Yours, > Linus Walleij
Re: [PATCH net-next v11 07/13] net: dsa: realtek: rtl8365mb: set and get vlan 4k for family D
Author: Gustavo Foletto Mora
Date: Thu, 19 Nov 2026 01:47
Date: Thu, 19 Nov 2026 01:47
84 lines
16679 bytes
16679 bytes
Hi Mieczyslaw,
On Wed, Nov 18, 2026 at 08:59 Mieczyslaw Nalewaj wrote:
> 1. With IVL_EN=0 (VLAN-unaware bridge), if the FID field of the bridge
> VLAN's 4K entry is set to 1 [...] does the chip learn the bridge hosts
> with FID 1?
> 2. Which VLAN4K entry do the standalone ports classify into with PVID 0?
> 3. If 1 and 2 work out, do static entries written with key.fid = 1
> replace the learned ones?
I measured this with your v12-pre2 from the OpenWrt PR
(https://github.com/openwrt/openwrt/pull/19644, head 7690a1c6db), as
that is the version that writes FID 1 into the bridge VLANs' 4K
entries: EX511 (RTL8367S), 6.18.44, the thirteen patches as they are.
Same setup as before: two bridge ports, two hosts on standalone ports
of the same switch, loopback cables in between. I can't read the FID
out of the chip with this build, so I inferred it from how the address
table behaves.
1 and 3: yes. In a VLAN-unaware bridge whose two ports have a PVID
("bridge vlan add ... pvid untagged" with VID 2, vlan_filtering still 0,
so that 4K entry has IVL_EN=0 and FID 1), the hosts are learned without
a VID. A static entry for h2 without a VID on the other bridge port (the
driver's SVL key with FID 1) took the place of the learned row: the row
on h2's port went away, h1 -> h2 stopped (0/6), and after the delete h2
was learned on its own port again. So the chip learns with the FID of
the 4K entry, and static entries with FID 1 replace the learned ones.
One detail there: br_fdb_add() without a VID on a port that has VLANs
also adds the entry for each of them, so the driver gets a second call
with VID 2 and writes it as an IVL row. That row is not looked up while
IVL_EN is 0 and becomes the live one once vlan_filtering goes on, which
I take to be intended.
2: with the bridge on PVID 2, the standalone ports (PVID 0) are not in
FID 1: with learning on, h1 -> h2 gives 20/20 (0/20 on v11's plain
bridge), and with a static entry without a VID on the far bridge port
the host behind it receives the frames (100/100; 0 with v11). Frames
tagged with a VID the bridge does not have (VID 5, no 4K entry) do not
get there: with learning on, tagged h1 -> h2 gave 0/20. I can't tell
from here whether they land in FID 0 or are dropped.
The plain br-lan is where it breaks. OpenWrt's default br-lan has no
VLAN at all: its ports keep PVID 0 like the standalone ports, and the
driver writes no 4K entry for VID 0, so the bridge is looked up in FID 0
while its entries are now written with FID 1:
- a static entry without a VID no longer steers or drops: with the
entry on the egress port the frames still flood to the uplink (104
out of wan for 100 sent; 7 with v11), and with it on the ingress port
they still go out of the other port (100; 0 with v11);
- the bridge's own host entries (br-lan's address, and what is learned
behind the CPU) take the same key, so I expect frames to the router
in a plain br-lan to flood to every bridge port. I did not measure
this one;
- with fdb_isolation, which v12-pre2 sets, DSA installs the standalone
ports' addresses as static host entries in FID 0. In the lab the
hosts are standalone ports of the same switch, so the plain bridge's
frames to them hit those entries and go to the CPU with
offload_fwd_mark set, and the software bridge does not forward them
on: h1 -> h2 fails with learning off (0/50; 50/50 with v11), 0/5000
in the load test, and the hosts are not learned on the bridge ports
at all. In the field a standalone port's address is usually the
router's own, so this one matters less, but it is the same shared
FID.
A way out could be to give the ports of a VLAN-unaware bridge a private
PVID whose 4K entry has FID 1, as mv88e6xxx does with
MV88E6XXX_VID_BRIDGED / MV88E6XXX_FID_BRIDGED
(mv88e6xxx_port_commit_pvid()). That would put the plain bridge where
the test above put it by hand, where all of this works. The tagged
frames with an unknown VID would still need a look.
On the 5.4 s: with the bitmap in v12-pre2 each vlan_filtering toggle
took 20-30 ms, and the rest of the toggle tests behaved as with v11
apart from the group entries.
The other things I found in v12-pre2 (the multicast key, a few comments)
are about code that is not on the list yet, so I put them on the
OpenWrt PR. I'll run the next version when you have it.
Thanks,
Gustavo
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