🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #17682

Re: [PATCH net-next v11 08/13] net: dsa: realtek: rtl8365mb: refactor PVID handling

#17682
From: Linus Walleij
Date: Tue, 17 Nov 2026 08:34
64 lines
11644 bytes
On Tue, Nov 17, 2026 at 8:39 AM Mieczyslaw Nalewaj <namiltd@yahoo.com> wrote:

> The PVID helpers (rtl8365mb_vlan_port_get_pvid(),
> rtl8365mb_vlan_pvid_port_set() and rtl8365mb_vlan_pvid_port_clear())
> work on a VLAN MC table index, which only family C has. Family D stores
> a raw VID in a per-port register, so it needs its own implementation.
>
> Move the helpers behind struct rtl8365mb_family_info, as already done
> for the VLAN 4k accessors: the existing code becomes the family C
> implementation (rtl8365mb_c_vlan_port_get_pvid() and the like), and
> the three functions above only call it through the vlan_port_get_pvid,
> vlan_pvid_port_set and vlan_pvid_port_clear pointers in the family
> info. The callers are not changed. The following patch adds the family D
> implementation without any is_d() check in the shared code.
>
> No functional change.
>
> The family C functions are not static because they are referenced from
> the family C info in rtl8365mb_main.c.
>
> Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>

What about:

int rtl8366_set_pvid() which is shared in realtek.h
and implemented in rtl8366-core.c.

It is currently only called from rtl8366_vlan_add() which
is only used by rtl8366rb.c.

realtek.h also have these as pointed out earlier to another
patch set:

struct realtek_ops {
(...)
        int     (*get_vlan_mc)(struct realtek_priv *priv, u32 index,
                               struct rtl8366_vlan_mc *vlanmc);
        int     (*set_vlan_mc)(struct realtek_priv *priv, u32 index,
                               const struct rtl8366_vlan_mc *vlanmc);
        int     (*get_vlan_4k)(struct realtek_priv *priv, u32 vid,
                               struct rtl8366_vlan_4k *vlan4k);
        int     (*set_vlan_4k)(struct realtek_priv *priv,
                               const struct rtl8366_vlan_4k *vlan4k);
        int     (*get_mc_index)(struct realtek_priv *priv, int port, int *val);
        int     (*set_mc_index)(struct realtek_priv *priv, int port, int index);
        bool    (*is_vlan_valid)(struct realtek_priv *priv, unsigned int vlan);
        int     (*enable_vlan)(struct realtek_priv *priv, bool enable);
        int     (*enable_vlan4k)(struct realtek_priv *priv, bool enable);
(...)

I *think* we agreed to push all of this into the RTL8366RB driver because
the way the RTL8366RB and RTL8365MB were dealing with VLANs
were just too different to share the abstraction.

If you can confirm that this is the case also for PVID I can send
a patch to push this into the RTL8366RB driver.

Yours,
Linus Walleij
Technical Details
Message-ID: <CAD++jLkJxM2yE2QwsDijqnsP+bH=xNfcNy+yj3hbv1k+q9aJ=g@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365040-linux-kernel-netdev=dewy.ru
References: <cf3fd237-2290-4002-8de0-ea4100ef0f85@yahoo.com> <bee46abf-f05f-4ea4-9797-f47adf8c78e7@yahoo.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365040-linux-kernel-netdev=dewy.ru
From: linusw@kernel.org (Linus Walleij)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v11 08/13] net: dsa: realtek: rtl8365mb: refactor
 PVID handling
Date: Tue, 17 Nov 2026 09:34:02 +0100
Organization: Usenet Network
Message-ID: <CAD++jLkJxM2yE2QwsDijqnsP+bH=xNfcNy+yj3hbv1k+q9aJ=g@mail.gmail.com>
References: <cf3fd237-2290-4002-8de0-ea4100ef0f85@yahoo.com> <bee46abf-f05f-4ea4-9797-f47adf8c78e7@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="2279009"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:HpyqPxE7WUAcykuxtVc5N0L+7rs= sha256:TFgUX7yfse1F0fXWtIebI6YogUEPndV/epdVy6kUTQE=
	sha1:9AhPzTcKsigABHb28G90gHVElBc= sha256:VTeRqXB/mhpQpOiNnBTlGDmx0AW6RbwuLUSUBLjMXrE=
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 53D28114E88; Tue, 17 Nov 2026 11:34:55 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.501
X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31
	tests=[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 wCQHNLjfC0Tz;
	Tue, 17 Nov 2026 11:34:52 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-365040-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 20624114911; Tue, 17 Nov 2026 11:34:43 +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 ED0AA3E10D; Tue, 17 Nov 2026 08:34:26 +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=1794904457;
	b=BXb0ktHhCSbQJU/X26zhoKSMC+X3SyjsQGwTlf06yoFaVjtUR1r6Z5HT4mvuiy6ReZXM
	 EZYGBVFy8w40R0FXKOpUs+K5mUh6IBsIDTLDA/N1bMzQ0PlwIBtY+siehY3UJi3C4tHh4
	 jkWr/mToYfEAeoPMwbu2ScxPEjkcD18ZFXW3tBOG7esbTaL/fdzfennap0Z1zsQSJNuJd
	 Y5mgMV9lUnJyxku/ZEWiwosWUQuViQAGKEEIVpbWNUl9e2XyIie0WjnpoDmmLtViPwUp6
	 HpbugCC2WpJoKfbj+PaqIANp8WTrzfZXvRH1V2lirTW3lvyaOsoGgBzaIfLf3cBEmsQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794904457;
	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=Xlo8wcQjaDqpJN+i27lOG2BNVNx2einhHXlhhNfvDxo=;
	b=a8w4427biYhzC6e0LPEtHrUUT9Kpa4mrxyALb3nzp3OEpSnHkHcVk5cMD347zX4R8ag6
	 XDUdpeGLkdW3wx+ALl22NHggyxJat5lDyCxrfCZnUbYIIJjlKEEN1q+PmUa7EEpL/5dKx
	 oOSJdl6VpE9eN6tbh5dcXYnEqxjoeuL0087+9t7MEi/BSt2xHYjq8y78XfN9XQht+oNqf
	 1lYofwPmZdL1gOb4is24KD+q08K5cvwWkrFFhVX5IfbQRgKlU9CnmWWjs/0yz3xsPeLY7
	 Xi3h1+rRzNA2z/iw9UjaqsAKTkLQpi3BdPH3diGScg3REW8RA77CTNTSSO9gX2lM+VA==
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=JwoGzyXw;
	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 3B6B8606A8A7;
	Tue, 17 Nov 2026 08:34:17 +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=JwoGzyXw
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=1794904456;
	b=gBxdsrS50/sdqkQRFjHXS6VgWqc4Wgtar1TpUeJgNOkBPdqpJQH5Ak5UvKFZPHrtZUbe
	 +AM2Xt8S4q2XdDDzuvuGVQLeebqHS8ioJ6LY4Lq0D72slXB6MFNLNefKmcVJc7MFyU07J
	 kgDYD+YxTt5SVuK4sSnsiKqLrSbIDk5pZAH5FBek+QLstsRIuwW+HmmMq6SjQ5wARLGzs
	 AtON+wkI8L3wKGmuAK3YW/A8TrLqK5PIXvMEvp3u/1U1EQ3jOTAhmHerBqQ6Cx780YM3m
	 9KAtlHrJvgi1SH6EFNksV2BFwl2BC16iLRSq2vKQgb/u3N8YEVj/u3nF0RuvLQtrZoA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794904456;
	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=Xlo8wcQjaDqpJN+i27lOG2BNVNx2einhHXlhhNfvDxo=;
	b=saIy48nv7OoEshwZ6I7URReCIwCpqBv+g59WUX5U6sUIBtdTM7Qq38qR+3JMsoKHkzat
	 9OiX7SHxl5/TCbYSoHXyFkmJxiucl6o1oZ9ZdpJEPZ4jP3t+KaYMCOOjCiaTipx+cNner
	 iDIxRRPqyacTkTz6yIWaLEzoqWZGrO0OCdLl/7REcXJBaDKl4WrYwOSTpZ3IYiH0hdidW
	 fYRoc4A6Zu/QDOc9jIepv3/rkgfMBhohzzF+mKrFsWB+JBcuYm4fnkqZbtdypEy8+PPK/
	 AQGkcllLhv1MdcsH+ULrGdG/9nNQXilLyOp2azhwAdP7PkkknTWvkL9xJ323wb3/48g==
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=JwoGzyXw;
	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 56E4860A2608
	for <netdev@vger.kernel.org>; Tue, 17 Nov 2026 08:34:16 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A4341F000C5
	for <netdev@vger.kernel.org>; Tue, 17 Nov 2026 08:34:16 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794904456;
	bh=Xlo8wcQjaDqpJN+i27lOG2BNVNx2einhHXlhhNfvDxo=;
	h=References:In-Reply-To:From:Date:Subject:To:Cc;
	b=JwoGzyXw3I6fmJU74safXu0edhbR2qlcATY8pxLsmIkQZ/CvsMKAcCFocrv+mU+N3
	 l9lFMIxvMggBzC3M6YDhmh9pQ/S0wR/8xeKy5tCmOcQx/oTXtkYT8rg8hBkoUt8Pn7
	 GU43FVhr2qxfb7YUoIuFs6LdmfjMsFe3cdwTRgG8if1LuzJ7ml8QMT67Mu1qUN0q7I
	 anUSZ27lS25UZqVD09/Qt+M4fuNPZ24aS/QAsBSQg9vfddQW9ZhEhoRatcWsV65Ptd
	 YqqgTWnAFEguHl4THEDM5qgUiHq6V1Gv7fFr1qVGFsOkOXgNxTX/a8DED0QGuWRuWW
	 dqaSOQue5qO6w==
X-Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-5be3d5927ceso642141e87.3
        for <netdev@vger.kernel.org>; Tue, 17 Nov 2026 00:34:16 -0800 (PST)
X-Forwarded-Encrypted: i=1; AL+hErGjHPI2Cua2KnIUI03fICrPKdsLJRl8LheMf1lSlSemvlXS9PaFJE5pWzYhn/bHUlLenFzsLC8=@vger.kernel.org
X-Gm-Message-State: APuU4Z/5dObKAFnDLsYW+vCLezGuXbsNoxPGERefiku0QLV+Pq9QPtKn
	eme5COLpGNex1MuBFvMr6ITzUYBgTQKq18iGXgDfzLgRGrWDBTJ3y2eZU6GVo8OJZjeD9Lo7UaM
	+1GBumOu079u9NplRvtdt6Mazpp8PaDs=
X-Received: by 2002:a05:6512:3c8c:b0:5bf:d60a:5c60 with SMTP id
 2adb3069b0e04-5c1709cf5f6mr5064151e87.55.1794904454868; Tue, 17 Nov 2026
 00:34:14 -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: <bee46abf-f05f-4ea4-9797-f47adf8c78e7@yahoo.com>
X-Gmail-Original-Message-ID: <CAD++jLkJxM2yE2QwsDijqnsP+bH=xNfcNy+yj3hbv1k+q9aJ=g@mail.gmail.com>
X-Gm-Features: Aa3M54pyqseL91ex5uV7ApTMHAGocbXWZwvG-XI7XkXAJVMEsnCU-17E2PSG6tw
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