๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19427

Re: [PATCH net-next v11 09/13] net: dsa: realtek: rtl8365mb: use raw VID for PVID on family D

#19427
From: netdev-bot+sashiko
Date: Thu, 19 Nov 2026 22:36
91 lines
11683 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The comments on the new PVID reset step contradict each other
  about whether the hardware reset leaves the PVID register in a knownโ€ฆ

--

net: dsa: realtek: rtl8365mb: use raw VID for PVID on family D

This patch adds family D versions of the PVID helpers. On family D the
PVID is a raw 12-bit VID in a per-port register at 0x0700 + port, not a
VLANMC index. It also calls a per-family vlan_port_reset_pvid hook from
rtl8365mb_vlan_setup(); the hook clears the PVID register on family D and
does nothing on family C.

> diff --git a/drivers/net/dsa/realtek/rtl8365mb_main.c b/drivers/net/dsa/realtek/rtl8365mb_main.c
> index 77ad84ea4a6d1..983257250205f 100644
> --- a/drivers/net/dsa/realtek/rtl8365mb_main.c
> +++ b/drivers/net/dsa/realtek/rtl8365mb_main.c
> @@ -2432,11 +2432,22 @@ static int rtl8365mb_port_vlan_del(struct dsa_switch *ds, int port,
>   */
>  static int rtl8365mb_vlan_setup(struct dsa_switch *ds)
>  {
> +	const struct rtl8365mb_family_info *fi;
>  	struct realtek_priv *priv = ds->priv;
>  	struct dsa_port *dp;
>  	int ret;
>  
> +	fi = rtl8365mb_get_family_info(priv);
>  	dsa_switch_for_each_available_port(dp, ds) {
> +		/* Start every port with the neutral PVID */
> +		ret = fi->vlan_port_reset_pvid(priv, dp->index);

[Severity: Low]
This comment says every port starts with the neutral PVID. On family C,
though, fi->vlan_port_reset_pvid() is rtl8365mb_c_vlan_port_reset_pvid().
That function just returns 0, and its kernel-doc relies on the hardware
reset value:

 * On family C the neutral PVID is VLANMC index 0, which is already the reset
 * value of the PVID control register, so there is nothing to do. Leave it
 * untouched to preserve existing driver behavior.

The new kernel-doc for rtl8365mb_d_vlan_port_reset_pvid() gives the
opposite reason for clearing the register:

 * On family D the PVID is a raw VID in a per-port register whose value after
 * reset is not defined by the driver (it may come from the hardware default or
 * from an EEPROM), so clear it to 0.

The header comment in rtl8365mb_main.c describes the EEPROM for all
supported chips:

 * The EEPROM contains initial register values which the chip will read over I2C
 * upon hardware reset.

Doesn't the same EEPROM reasoning also apply to the family C PVID register
at 0x0700 + (port >> 1)?

Suppose an EEPROM preloads a non-zero MC index there. Then
rtl8365mb_c_vlan_port_get_pvid()->rtl8365mb_vlan_get_pvid_mc() could
return a non-zero evid. rtl8365mb_port_vlan_filtering() would then select
RTL8365MB_FRAME_TYPE_ANY_FRAME, which is the same situation this patch
fixes on family D.

That runtime behaviour on family C is older than this series, because
rtl8365mb_vlan_setup() never touched the family C PVID before. The rest
of the series also leaves rtl8365mb_c_vlan_port_reset_pvid() unchanged.

Would it make sense to have the family C hook write MC index 0 through
RTL8365MB_VLAN_PVID_CTRL_PORT_MCIDX_MASK(port)? Alternatively, the
comments in rtl8365mb_vlan_setup() and rtl8365mb_c_vlan_port_reset_pvid()
could be reworded so they don't promise a neutral PVID that the code
doesn't enforce.

> +		if (ret) {
> +			dev_err(priv->dev,
> +				"Failed to reset PVID on port %d\n",
> +				dp->index);
> +			return ret;
> +		}

[ ... ]

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cf3fd237-2290-4002-8de0-ea4100ef0f85%40yahoo.com
Technical Details
Message-ID: <179512779167.3136.16350479075659467985@kernel.org>
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-367386-linux-kernel-netdev=dewy.ru
References: <62c7fce5-0296-4e66-92c9-fdb501ef592a@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-367386-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v11 09/13] net: dsa: realtek: rtl8365mb: use raw
 VID for PVID on family D
Date: Thu, 19 Nov 2026 22:36:31 +0000
Organization: Usenet Network
Message-ID: <179512779167.3136.16350479075659467985@kernel.org>
References: <62c7fce5-0296-4e66-92c9-fdb501ef592a@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2999266"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:qBPqW1RT6MOcHhPKB9aM5PKJD3s= sha256:uobbufjB2X92m5ytbnaVQ0A1iokgvXbSfzpp9c+2eUQ=
	sha1:v3bJb0nEgPdm0cTya0C+HTIqCPs= sha256:Bg+viMmXcvWH026pRzTfoX5MVNJeVxGSHNq4XQbX2jA=
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 9EDB31157D3; Fri, 20 Nov 2026 01:36:50 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 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, URIBL_BLOCKED=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 hIutFGJBkZpG;
	Fri, 20 Nov 2026 01:36:47 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-367386-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 A72BD1157D0; Fri, 20 Nov 2026 01:36:37 +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 D4654262375; Thu, 19 Nov 2026 22:36:34 +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=1795127794;
	b=Xc/nSEcSES9WJ1LdV36HwS8rDkid2Rr7P5zJTYnSct+fz73psGR/LtluwFZ2ertFwmyo
	 noBl/JojtLUbxxzITdzDbVIBqsQ8vljzH6awH2f1cqHz8T13UCaand3+RHixQKPR9VSAP
	 qf5BqRwJMjAdGOG+x3zzh4rKkmGA3xseIOnKA5cn/L6io60gQ2I9DXmH/5qAdwQPI3BCw
	 g7PGPXCSrN5O9Ilfm7vYOjqEVIwJfR0NWYTf7xX9VsDIx8i2zJ3nfcD0fs+yyeBVAqJQj
	 h9T+ZjKtXe5t5fgUFoptHmXm3dIfOxJbwQqzR8RpPcDzesrI3nnibvbHznQnpqO6Clg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795127794;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=EQND8DtByypeGvKjlf1d8I5SCOd8zNIl7zb8J8w2nKA=;
	b=Q0p6wxfKzDoeT+Jf8uXJ7eaOv4kTSfzILdVTMJN1j4oW9g6Ih/Ryuf1FGWX/Fm5XkPnq
	 uYEvHXhP6rf4P83hUZQfdrDHrbNTtwt3kyfPAeSzIduXh6rbXaoNlAKMaqIOjI4udW8wV
	 003aaF9wI3F/xZ/Fkwi3/O2lYivm6YiiRmfZ9hFh8Sk/WtuW7Nwb2twyGveC83HoLvsv4
	 g74JP8HGgDQlkqtW8ZzwaVOvNG2yTBCS9FHN6uCMIPq4qO3SYbgzxD9APudz8zrZLE1x/
	 GZh8A+p/d6za/AjAtNeKP9ZivWrhafhCb0JltN+oBXTndnrWwxMzvDi28aKhYVtik+A==
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=lkmlGfJv;
	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 129A2606A336;
	Thu, 19 Nov 2026 22:36:34 +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=lkmlGfJv
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=1795127793;
	b=ZYSuA+V/hkDEfzph7gTSt0BbPkaGgLh2dOCwQZvHY6oQKaJXBgU11lQ/2e1jCXgI5rBO
	 Hwp0or6dh1UYgvc4mqJ/r9DV4r8BvHYEeNCH34SPBY7DrVyOqw7YfPcqLZEUOYropfqBt
	 //pVsTJeR04V3rWVj63EIjZYsW8sjlpg9wH4dtkWGec/IETC6hdPXnNAUInlFwZ3qFkMt
	 wJk91C3kAEJbKMtMmSmUYK/GU+9Dd79AE3l1Pw3w60MYVcpqaFdPw4hvyrn0XCcD98X2q
	 lHOwU1dKS+5nhvQbNrwQjFURPWvCrJF9NK06MflIrFuVuTUgNANiM8Qxjo0VKL4Q7IA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795127793;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=EQND8DtByypeGvKjlf1d8I5SCOd8zNIl7zb8J8w2nKA=;
	b=cfSX6YCH3wnHTyhwdhsNAKRROOW9z/v4bUJaj/YVs5GlSHIjFl2/rnPynGV9W2xnhZFH
	 EU3/CohCyZkl5LsRwztIY++A80BBvOipmQpOFAWry12VFV8W7BRgeS1n9q82DzyLitgMA
	 +FMc8mXFzi5npNo4McJeg44MVPZnkJz4PA39xKzHtrLMpEqrh86Y576n2RTWZdWcwrwaA
	 dbKTfOKb8/EiwXPhJi72G++iPjbTvNCVKCPubTWxgasQaxoQrGnCEiqE8znhxqtRJX6Ti
	 L3pmrhr5YXyolqkHmgcG7D1U6lhLIJWvXvpwa2GmKxMnaM2lYGOgfiGdX9moBv5C1QA==
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=lkmlGfJv;
	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) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33A2B606A337;
	Thu, 19 Nov 2026 22:36:33 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 182A91F000C0;
	Thu, 19 Nov 2026 22:36:32 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795127793;
	bh=EQND8DtByypeGvKjlf1d8I5SCOd8zNIl7zb8J8w2nKA=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=lkmlGfJvUhqUHl3wzHkpz6HT10pDBrv21YMR4VHzR5gSSAp/n4EpJ6nw2mxDxWkiw
	 82BV6nuJ/hl9JmKqi5+p0tQtrx8yuYRzmJBBeZ6U5smU5uWuKLLqgAoIxuiBEYbBNq
	 GP+eePm5t3E4hZMP24ET+2YjaAZeLCBNPtR13kTw75RY3sKF4WbioNJr05QQjDdtrU
	 GmAoZJGHQAepx7Plm9M00K+oYn7I3lH+9ZbOLIJ3QJXbRT4ZRiTdoGECBkIxRSWGlx
	 MH+iNyWEZ9w1S3kyR3Ib2IjF3sHnpU8ICzx6WeYHN9gV7gbQHAy7gkTT6assIalK/V
	 JrXXAtDAAQgRQ==
X-Cc: linusw@kernel.org, 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
X-In-Reply-To: <62c7fce5-0296-4e66-92c9-fdb501ef592a@yahoo.com>
X-sashiko-severity: Low
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