From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795992553; b=jQB3yFne22c+rLjuBGqaoTiAXGFokroVxpjPomDblnRnw1jei0mIHsfnfs8mSCeS+VmL ZxjAqIo34Dhg1o0HYXx7GQYtzBoSKxQWxlXFyceB+MQoCRx2fpkdeuX6Y/hqQ7rzuaQtE m7UDclOpYyIZ9Br0Cg6A+eru8ZvpgKzuwn09gSujKWcb3NDqv44kxfFHgBK9x9/oIbIiJ 0M46w8UkwvQosFawwxhGzVZGI1XPJogPIXIZROsbf/+uJc+hvskQbCzR2vibAuxenIpD4 qo0mBG3LdaREzFlv4jcul47HXttiUMfxSwX1bX0E3wEoKhk02qC64uUc4pGp75EP2Og== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795992553; h=Received:DKIM-Signature:Received:X-Forwarded-Encrypted: X-Gm-Message-State:X-Received:MIME-Version:References:In-Reply-To: From:Date:X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID: Subject:To:Cc:Content-Type:Content-Transfer-Encoding; bh=oO/Oz1Il6q4NrChcTPfvAGhMzWzSfzxjkHrqXenlLSs=; b=gDBTZq0+piHHteOYoyZE4EeWNI82uTexqQ1TxXkG8ydJJDcP72YloR3ZBtkU16x2ajcz It29pewKFZ1D3+C/EAxg2XGOaMA/lvPS02GLZBpbz4ZDSiqXdeMcfau2xWOhe1Pr1VhJV gZ05k1yTI0wVFXT/egBG/PDUHS0aty1b1H6LHTiIuywgFuswjEhw0av5VsGP3jfkTIkvI arQvbUHJXgxUQd31KW3JVmamssqiodp49lmnKTX4Bs0UCsoLvYhxXdB4xMRVsoGfd0c6I biS7JY6ET+Dq4dB4X7oRDgSujgNGDwN7mCcbW/kHBgt5hFy1rZObUwWWqZ2URH1gsDg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NG2oSRSH; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2EA52606A31C for ; Sun, 29 Nov 2026 22:49:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NG2oSRSH Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67F441F00929 for ; Sun, 29 Nov 2026 22:49:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795992552; bh=oO/Oz1Il6q4NrChcTPfvAGhMzWzSfzxjkHrqXenlLSs=; h=References:In-Reply-To:From:Date:Subject:To:Cc; b=NG2oSRSHEVzqSnr2jkG8J/h12onEeDWphZK3aQW27dLOmC9GEpq65wg/rv6qC4u7j +yvQ4gFPef9I+MO/KWvo9BR9VTcZGbuVZ/Rm233iw5fWDy2cWxiIgI5wqNPKACmNiu lOCwgXOUvb/QTHosm58DQDKo4YdYItUOumtbqUJUtQaZxmUx7zOgaK6gC+GgG7bFlU ZEU4v1/AipH1WVFS1AWUIT87UiH9DE9wAsCe/q11lWtkO8XwkTj0rwSF+BtpUchUOM 6sziMk/cC0iZc5zdiAhEdBvxw23VahuyoiFU33mx2senwVoLauP7euXmG3w4h+XeMs iVB+QFTv0U3JA== Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-5c10dc41270so10157814e87.2 for ; Sun, 29 Nov 2026 14:49:12 -0800 (PST) X-Forwarded-Encrypted: i=1; AL+hErGzUAodxfwJBwUSofzgILb2BNlbcjoQJJSYyfL7y3Tt1kY0VY20oTPShtOI/vmen6QLSVREbY3s10YaPPY=@vger.kernel.org X-Gm-Message-State: APuU4Z+Czf1yMXuHQkqmNmu0YQvYXX09P9+H2I1y2huLFQo/D1Tt9lCi sEWZcc8SqUPcfxPdh9VTw7/+xk3G7RtgoqY/BB2+gbEVCULCmImvBR1aBzA9tDMV6lChGrMBmYu H6gyvKBJZeJSOL07uS7VCaIU9KYeINNo= X-Received: by 2002:a05:6512:61aa:b0:5c0:e5:7e49 with SMTP id 2adb3069b0e04-5c1bc806f13mr8593603e87.44.1795992551150; Sun, 29 Nov 2026 14:49:11 -0800 (PST) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 References: <388e3024-0731-4113-a25a-1e739d6a0c39@yahoo.com> In-Reply-To: <388e3024-0731-4113-a25a-1e739d6a0c39@yahoo.com> From: Linus Walleij Date: Sun, 29 Nov 2026 23:48:59 +0100 X-Gmail-Original-Message-ID: X-Gm-Features: Aa3M54op3VQXOOhPPgbMQU6lydDQKT4jgpkCn2bRaBa9N2gN9ugnsX2EGtrI9ug Message-ID: Subject: Re: [PATCH net-next v16 07/15] net: dsa: realtek: rtl8365mb: set and get VLAN 4k for family D To: Mieczyslaw Nalewaj 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Nov 29, 2026 at 4:07=E2=80=AFPM Mieczyslaw Nalewaj 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 > Signed-off-by: Mieczyslaw Nalewaj Looks reasonable. Reviewed-by: Linus Walleij Yours, Linus Walleij