🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24244

Re: [PATCH net-next v16 07/15] net: dsa: realtek: rtl8365mb: set and get VLAN 4k for family D

#24244
From: Linus Walleij
Date: Sun, 29 Nov 2026 22:48
76 lines
13099 bytes
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
Technical Details
Message-ID: <CAD++jLmLcRE76_WNN4kr5Z4v4gFp0Wb8HnUnf=_Zh4PCZM3v_w@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373687-linux-kernel-netdev=dewy.ru
References: <aebcc7f6-d5f8-4157-b63a-e2e707d9859b@yahoo.com> <388e3024-0731-4113-a25a-1e739d6a0c39@yahoo.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373687-linux-kernel-netdev=dewy.ru
From: linusw@kernel.org (Linus Walleij)
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <CAD++jLmLcRE76_WNN4kr5Z4v4gFp0Wb8HnUnf=_Zh4PCZM3v_w@mail.gmail.com>
References: <aebcc7f6-d5f8-4157-b63a-e2e707d9859b@yahoo.com> <388e3024-0731-4113-a25a-1e739d6a0c39@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="1278401"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:aoHUx6xxzk4tf3UjImZeDZdVyxA= sha256:35GxWl12k1AdJ/c2gqjutryggFjRWguxszlB1A3Ds44=
	sha1:MJpEhPFbMh9TDrCfnhXp7jc8K4Q= sha256:83M2GHB/ij9t1O6/b6NsEZLqe87LAz8224vw7/2meJY=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 921F6125FB1; Mon, 30 Nov 2026 01:49:27 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id VYM8ZyY7dQ4Z;
	Mon, 30 Nov 2026 01:49:24 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373687-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 2C898125F08; Mon, 30 Nov 2026 01:49:16 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 396B426117; Sun, 29 Nov 2026 22:49:14 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795992554;
	b=hwtDElIAhrVM9Kht6tojNsmGeRAmDAHyymyZ+h8vJWT79ytr+w24kjYfne3htMXnpbc1
	 PrGUpWpKeRW5pCSbtDSs96YsLusjJGM53ggehIYVrQOI6zWm7rt1oL7vw/sUHeKlhBK7g
	 w9WznfOMCxUqBRmpkh6LJR3mQQakxs15doBfZUknFYi8QOBu3uEkpugQOEHAMDLUmA7uZ
	 J+NthGMcNfsjYrmBOtxio7Z7CARgFNowpfhV9u9j98ZRaF+EJF3+1vjWN9CQeyptJNvTJ
	 6/SHz0l+8II2SrVL4cFMK2wKqBAA3C19Vl0FBqIvSHn/JlUvP/+j9uK0NJdG4WDckNw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795992554;
	h=X-Original-To:Received:Received:DKIM-Signature:Received:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence: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=cZKnvEuhqt/bZJKhTNPQyKpCY+tdSqsFiwXVvzmRj5JmQQ9v4t0jepDGscVRm0cf39N8
	 +LB5BXFxetlCv08uPSUd7E0Xq/4MuOKoubjdimkG5H/4dlo+29vuHjtDRDRzycIQRgjcn
	 OxUihPDXC3qRt0Vv4kUFzcSEAVwnvtqg0otUtNQiyLOpPIt6wX+UWd+tQRIyuMdTS6CpU
	 LlrY6mT9X6Gr7WOeKfZcphd3hGT6W9MMCD9ZpE66MDb+wx7TmH+tMP3BPWmLTgOETg98Z
	 9OVUeXwqcGvNO7hFR7MQN+ljd7rDaKm6H4VBHVmr7boJ3gTi7/1o8Z0mIgPyAezaLXQ==
X-ARC-Authentication-Results: i=2; 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=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 11C2E606A32F;
	Sun, 29 Nov 2026 22:49:14 +0000 (UTC)
X-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
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795992553;
	b=Um8sqY4e7OhoP2ksNIFzSPeCLQN/6QD36Xhj9nILG+LeDTEt+H4t6eWgVk0JVy2AsR+o
	 q/PogLJ2IXocUwILsbuWspOl4435kh9kRwdBkHorunJkMqzPEV6WixPcTaUmmlcAP0+xb
	 HZHAY720T2eWZbyC4jGp4oW2ph+AYkAhXx8XozuH17VHg3iQA2fVA0mh5r9R/A/EI02xL
	 l3PcG0rOrunj+2F95rMRDcuGQxUp+EnyBFxBhzla/cW8bhG/ErBq1mow5ofTxD8Vp/Yf2
	 +qH9VdCrRwuCBtuWuEgh1zk9ny9lkPH9k+aPsXsy8dPFiy/IK6QRsfJG4RpxxVcOvyw==
X-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=gOdF45EONXAKgQ97vHleO6kSgkSmc9hdfhVJV/dU+ca83pzy1e/moo1t20RB9r6KoDff
	 pt69zN3L4v6m4JTdc0JrA8GyTCPnw+DbuUhUMq7E8KSwH9TqsOVClUjDTg2qf3BphKN9P
	 UMxL+z4L7HbRWNWJtGaWQS20WUGThkE98axb5Ge1pfSPVRul4kWegemXgXYs2/uETUmY+
	 vd3Y3HABe8xW1EqAbJS/DFff5j2D+4nZdv/q682GE85GOJgiKCZd9qDxrRaKjl6vB4tXK
	 Y464MEgVDvy5UlOVMOHUJTWGA6B+vJkKobfS/obSl+c7Cn7TMbcCBHuC2jcT7+DIuKQ==
X-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
X-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 2EB83606A325
	for <netdev@vger.kernel.org>; Sun, 29 Nov 2026 22:49:12 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D52B1F0092F
	for <netdev@vger.kernel.org>; Sun, 29 Nov 2026 22:49:12 +0000 (UTC)
X-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==
X-Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-5c14a204305so6555517e87.3
        for <netdev@vger.kernel.org>; Sun, 29 Nov 2026 14:49:12 -0800 (PST)
X-Forwarded-Encrypted: i=1; AL+hErFRw04o2c319ZazwiHUYFuXFQ1RftYgpjywqHsRBaZqivAg96QVq3bhDNlZpkfLrAQgAjn/e9M=@vger.kernel.org
X-Gm-Message-State: APuU4Z9YRRJmN+TI10ylWSqxKPEYRUHhHFTj/xGEKWGJ6bruSahmk0BA
	zEKd8iZfvqrRaKav/pf1qHJTFXwW/gHkME3gX6/zWgvKfSrR6qyaglYZt8O6nDx1o72J7EtMUj1
	zgkDJgrERNVAKM7q4YwdkxTh86K3EO0M=
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: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <388e3024-0731-4113-a25a-1e739d6a0c39@yahoo.com>
X-Gmail-Original-Message-ID: <CAD++jLmLcRE76_WNN4kr5Z4v4gFp0Wb8HnUnf=_Zh4PCZM3v_w@mail.gmail.com>
X-Gm-Features: Aa3M54op3VQXOOhPPgbMQU6lydDQKT4jgpkCn2bRaBa9N2gN9ugnsX2EGtrI9ug
X-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