Re: [PATCH net] net: dsa: b53: be VLAN unaware when not filtering

Jonas Gorski <[email protected]>
Newsgroups org.kernel.vger.netdev,org.kernel.vger.linux-kernel
Message-ID <CAOiHx=kqmZSM2Vzusc_bcpJfTjJC=jYPgU3wnz_xX+_nnuiNtw@mail.gmail.com>
On Thu, Aug 6, 2026 at 12:23 PM Vladimir Oltean <[email protected]> wrote:
>
> On Wed, Aug 05, 2026 at 09:44:51AM +0200, Jonas Gorski wrote:
> > While SVL is active, any ARL add/remove operations ignore the VID
> > field/register and force it to 0, making existing static ARL entries
> > with VID != 0 inaccessible, and any (static) ARL entries added will
> > have their VID set to 0, regardless what the software entry said.
>
> Is this a hardware limitation, or is it because global state
> (dev->vlan_enabled) blinds b53_arl_rw_op()'s attempts to look at FDB
> entries of the other type?

This is a hardware limitation.

The hardware hash function to determine the table index for a {
VID,MAC } entry ignores the VID field (or rather treats it as 0) when
filtering / 802.1q mode is disabled. This is done for all ARL
accesses, both destination port lookup on forwarding as well as when
doing ARL table operations.

You can manually write entries with VID != 0 as the VID used for table
index calculation and the VID of the entry are two different register
fields, but the entry will then be written to the wrong index,
preventing them from being matched when looking them up on forwarding
in filtering/802.1q mode.

I verified this by writing entries with VID != 0 with 802.1q mode
disabled, and then looking up the MAC for VID 0 with 802.1q mode
enabled, which then found the entry with the VID != 0, and looking up
the MAC with the entry's VID did not find the correct entry.

>
> static int b53_arl_rw_op(struct b53_device *dev, unsigned int op)
> {
>         u8 reg;
>
>         if (op > ARLTBL_RW)
>                 return -EINVAL;
>
>         b53_read8(dev, B53_ARLIO_PAGE, B53_ARLTBL_RW_CTRL, &reg);
>         reg |= ARLTBL_START_DONE;
>         if (op)
>                 reg |= ARLTBL_RW;
>         else
>                 reg &= ~ARLTBL_RW;
>         if (dev->vlan_enabled)
>                 reg &= ~ARLTBL_IVL_SVL_SELECT;
>         else
>                 reg |= ARLTBL_IVL_SVL_SELECT;

This ARLTBL_IVL_SVL_SELECT bit is only implemented for a small subset
of switches (bcm5302x / bcm58* and bcm53134). Additionally, according
to the register description, this also requires enabling "per port
IVL/SVL" mode, which is not enable by b53. The description of that
also says that the VIDs used in SVL ports must not be used in IVL
ports. No idea what the consequences are if they do.

Best regards,
Jonas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.