From: Linus Walleij <linusw@kernel.org>
To: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Cc: andrew@lunn.ch, olteanv@gmail.com, kuba@kernel.org,
davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
linux@armlinux.org.uk, luizluca@gmail.com,
maxime.chevallier@bootlin.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, alvin.sipraga@analog.com,
gusfmora@gmail.com, kuncy7@gmail.com, fabianotassotti@gmail.com,
gabonpivovich@gmail.com, contact@c127.dev,
o.rempel@pengutronix.de
Subject: Re: [PATCH net-next v16 07/15] net: dsa: realtek: rtl8365mb: set and get VLAN 4k for family D
Date: Sun, 29 Nov 2026 23:48:59 +0100 [thread overview]
Message-ID: <CAD++jLmLcRE76_WNN4kr5Z4v4gFp0Wb8HnUnf=_Zh4PCZM3v_w@mail.gmail.com> (raw)
In-Reply-To: <388e3024-0731-4113-a25a-1e739d6a0c39@yahoo.com>
On Sun, Nov 29, 2026 at 4:07 PM 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.
>
> After a successful switch-wide IVL_EN change, flush the dynamically
> learned L2 entries on every user port, so that none learned with the
> previous SVL/IVL key remains, whatever the chip does on its own. Such
> entries must not occupy LUT slots or become visible again after a later
> toggle.
>
> Do not advertise vlan_filtering_is_global: ingress and egress VLAN
> filtering remain per-port, and only the learning key used by active VLAN
> entries follows a switch-wide policy. VLAN-unaware traffic is meant to
> use the SVL key with VID 0, which the L2 patch implements together with
> port-based FID 1. Because the policy is switch-wide, if a VLAN-aware and
> a VLAN-unaware bridge share the switch, the VLANs of both use IVL and the
> learned entries of the VLAN-unaware one no longer match its static VID 0
> (SVL) entries. The L2 patch limits the switch to one new bridge number,
> but a bridge numbered by another switch can still be offloaded here. This
> is a known limitation.
>
> The update visits only the VIDs in use, tracked in the vlan_4k_used
> bitmap in struct realtek_priv. rtl8365mb_vlan_4k_port_set() keeps it up
> to date under vlan_lock, so a toggle does not read all 4094 entries over
> the slow management bus (about 5 s per toggle on an RTL8367S-VB; 20-30 ms
> with the bitmap). The bitmap covers the entries written by this driver:
> an entry that was already in the table before the driver loaded is not
> visited. An entry that loses its last member is written back with IVL_EN
> cleared, as in its reset state, so that it is not left in IVL after it
> drops out of the bitmap. The rewrite itself is a separate function,
> rtl8365mb_d_vlan_4k_set_ivl(), so that an error path can restore the
> previous state.
>
> 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, which matches the vendor switch API
> for this chip family (it writes only 0x0510/0x0511 for a CVLAN entry):
> 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.
>
> 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.
>
> Tested-by: Gustavo Foletto Mora <gusfmora@gmail.com>
> Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Looks reasonable.
Reviewed-by: Linus Walleij <linusw@kernel.org>
Yours,
Linus Walleij
next prev parent reply other threads:[~2026-11-29 22:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <aebcc7f6-d5f8-4157-b63a-e2e707d9859b.ref@yahoo.com>
2026-11-29 15:02 ` [PATCH net-next v16 00/15] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-11-29 15:06 ` [PATCH net-next v16 01/15] dt-bindings: net: dsa: realtek: add RTL8367S-VB Mieczyslaw Nalewaj
2026-11-29 15:06 ` [PATCH net-next v16 02/15] net: dsa: realtek: rtl8365mb: add chip family infrastructure Mieczyslaw Nalewaj
2026-11-29 15:06 ` [PATCH net-next v16 03/15] net: dsa: realtek: rtl8365mb: refactor forcemode handling Mieczyslaw Nalewaj
2026-11-29 15:07 ` [PATCH net-next v16 04/15] net: dsa: realtek: rtl8365mb: set speed for family D Mieczyslaw Nalewaj
2026-11-29 15:07 ` [PATCH net-next v16 05/15] net: dsa: realtek: rtl8365mb: set RGMII mode " Mieczyslaw Nalewaj
2026-11-29 22:47 ` Linus Walleij
2026-11-29 15:07 ` [PATCH net-next v16 06/15] net: dsa: realtek: rtl8365mb: refactor VLAN 4k handling Mieczyslaw Nalewaj
2026-11-29 15:07 ` [PATCH net-next v16 07/15] net: dsa: realtek: rtl8365mb: set and get VLAN 4k for family D Mieczyslaw Nalewaj
2026-11-29 22:48 ` Linus Walleij [this message]
2026-11-29 15:07 ` [PATCH net-next v16 08/15] net: dsa: realtek: rtl8365mb: refactor PVID handling Mieczyslaw Nalewaj
2026-11-29 15:11 ` [PATCH net-next v16 09/15] net: dsa: realtek: rtl8365mb: use raw VID for PVID on family D Mieczyslaw Nalewaj
2026-11-29 15:11 ` [PATCH net-next v16 10/15] net: dsa: realtek: rtl8365mb: add family D SDS13 PCS support Mieczyslaw Nalewaj
2026-11-29 15:11 ` [PATCH net-next v16 11/15] net: dsa: realtek: rtl8365mb: refactor L2 MAC handling Mieczyslaw Nalewaj
2026-11-29 15:11 ` [PATCH net-next v16 12/15] net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D Mieczyslaw Nalewaj
2026-11-29 15:12 ` [PATCH net-next v16 13/15] net: dsa: realtek: rtl8365mb: refactor QoS priority handling Mieczyslaw Nalewaj
2026-11-29 22:51 ` Linus Walleij
2026-11-29 15:12 ` [PATCH net-next v16 14/15] net: dsa: realtek: rtl8365mb: use PCP numbering on family D Mieczyslaw Nalewaj
2026-11-29 22:52 ` Linus Walleij
2026-11-29 15:12 ` [PATCH net-next v16 15/15] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAD++jLmLcRE76_WNN4kr5Z4v4gFp0Wb8HnUnf=_Zh4PCZM3v_w@mail.gmail.com' \
--to=linusw@kernel.org \
--cc=alvin.sipraga@analog.com \
--cc=andrew@lunn.ch \
--cc=contact@c127.dev \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fabianotassotti@gmail.com \
--cc=gabonpivovich@gmail.com \
--cc=gusfmora@gmail.com \
--cc=kuba@kernel.org \
--cc=kuncy7@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=luizluca@gmail.com \
--cc=maxime.chevallier@bootlin.com \
--cc=namiltd@yahoo.com \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®