Re: [PATCH net v2 2/2] net: dsa: realtek: rtl8365mb: keep the neutral PVID in VLAN-unaware bridges
From: Luiz Angelo Daros de Luca
Date: Fri Nov 20 2026 - 14:30:28 EST
> Luiz, this ties in with your mail. One correction first: the patch
> does not move ports without a PVID to the bridge PVID, it does the
> reverse, it keeps the neutral PVID on the ports of a VLAN-unaware
> bridge. Your main point stands though, and I tested the SVL direction
> on hardware.
Thanks Stijn for all this effort and testing.
> The switch has a port-based FID (enable mask at 0x07ac, one FID per
> port from 0x07ad). I tried it on an RTL8367S and on an RTL8367S-VB, the
> latter with the L2 entry layout from Mieczyslaw's v10:
I will check Mieczyslaw's v10 after this patch. RTL8367D doesn't have
an EFID. Without EFID, the same MAC appearing in the same VLAN for
different bridges will collide in the L2 table.
> - The port-based FID alone changes nothing while the VLAN4k entry of
> the VLAN a frame is classified to has IVL set. The learned key
> stays {MAC, VID}.
Wouldn't it be {EFID, MAC, VID}? Or, for standalone ports, {0, MAC, VID}?
> - With that VLAN4k entry in SVL, the learned key is {MAC, FID}, and
> the FID is the one of the ingress port, not the one in the VLAN4k
> entry.
The FID in the VLAN4k might only be related to MSTP. It is not used in
the driver yet, so I never figured out its actual purpose.
> - A static unicast entry written as SVL with the port's FID replaces
> the learned one in place. The roaming case from the commit message
> passes, 10 of 10 pings, on both chips.
Great. That's what I was expecting. And does that replacement happen
even if different VLANs are involved?
> - Multicast entries follow the port's FID as well. With an SVL entry
> whose only member is an unused port, 0 of about 40 frames reached
> the CPU while the ingress port had the entry's FID, and 38 (39 on
> the VB) once I gave the port another FID.
OK.
> - Two VLAN-unaware bridges on the RTL8367S, each with its own FID: the
> same MAC and the same group in both give separate entries, deleting
> the group in one bridge leaves the other's entry alone, and traffic
> of one bridge does not hit the entry of the other.
Here I wonder how the EFID would interact with that FID. I believe
each standalone port requires its own FID, as they share the same
EFID=0. However, each bridge has its own EFID, which should be enough
to isolate entries from different bridges. But Mieczyslaw's code might
have come up with a different solution.
> - Tagged frames, on both chips: with the VLAN4k entry of VLAN 20 in
> SVL, a station sending in VLAN 20 is learned as {MAC, port FID} and
> the roaming case passes, 10 of 10. With the entry in IVL as today it
> fails, 0 of 10.
Great. We just need to avoid the same VLAN being used as SVL for one
bridge and as IVL for another.
> So for v3 I would drop patch 1, leave VLAN 0 in SVL, and:
>
> - give each VLAN-unaware bridge its own FID and enable it on the
> ports of the bridge while they do not filter,
And how does EFID fit into this?
> - keep the neutral PVID on those ports, as patch 2 does now, so that
> untagged frames are classified to a VLAN in SVL,
OK
> - write the VID 0 FDB and MDB entries from DSA as SVL with the FID of
> the bridge,
OK
> - as a separate patch, write a VLAN4k entry as IVL only while one of
> its member ports filters, and as SVL otherwise, so that tagged
> frames in a VLAN-unaware bridge are looked up by MAC as well.
I'm not sure about that. We might need to avoid enabling the VLAN
filter if there is another VLAN-unaware bridge also using that same
VLAN (as well as avoiding adding a VLAN-unaware port to an IVL VLAN4k
entry).
> VID 0 is then no longer part of any lookup key, and multicast is
> separated per bridge by the FID. vlan_filtering_is_global is not
> needed. What remains is a VLAN that a filtering and a non-filtering
> bridge on the same switch both use: it stays in IVL.
OK
> The FID is 4 bits on the RTL8367S and 2 bits on the VB, which limits
> the number of such bridges.
There are multiple FID's in the vendor code (it is confusing). You
might be referring to:
#define RTL8367C_PORT0_PBFID_MASK 0xF
#define RTL8367D_PORT0_PBFID_MASK 0x3
RTL8367C uses a 4-bit PBFID. I still wonder about the relationship
between the EFID and the port-based FID defined in this register.
> Does this direction work for you? As this is no longer a small fix, I
> will send v3 for net-next, keeping the Fixes tag, unless you prefer it
> in net.
The Fixes tag is appropriate since the code is broken in this specific
situation. Let's fix it in net-next and backport it to net. With all
the expected changes, it might require manual intervention to get
merged into all stable kernels.
Best regards,
Luiz