Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: namiltd@yahoo.com
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
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	[thread overview]
Message-ID: <179512779167.3136.16350479075659467985@kernel.org> (raw)
In-Reply-To: <62c7fce5-0296-4e66-92c9-fdb501ef592a@yahoo.com>

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

  parent reply	other threads:[~2026-11-19 22:36 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cf3fd237-2290-4002-8de0-ea4100ef0f85.ref@yahoo.com>
2026-11-17  7:34 ` [PATCH net-next v11 00/13] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-11-17  7:35   ` [PATCH net-next v11 01/13] dt-bindings: net: dsa: realtek: add RTL8367S-VB Mieczyslaw Nalewaj
2026-11-17  7:36   ` [PATCH net-next v11 02/13] net: dsa: realtek: rtl8365mb: add chip family infrastructure Mieczyslaw Nalewaj
2026-11-17  7:36   ` [PATCH net-next v11 03/13] net: dsa: realtek: rtl8365mb: refactor forcemode handling Mieczyslaw Nalewaj
2026-11-17  7:37   ` [PATCH net-next v11 04/13] net: dsa: realtek: rtl8365mb: set speed for family D Mieczyslaw Nalewaj
2026-11-17  7:38   ` [PATCH net-next v11 05/13] net: dsa: realtek: rtl8365mb: set RGMII mode " Mieczyslaw Nalewaj
2026-11-17  7:38   ` [PATCH net-next v11 06/13] net: dsa: realtek: rtl8365mb: refactor VLAN 4k handling Mieczyslaw Nalewaj
2026-11-17  7:39   ` [PATCH net-next v11 07/13] net: dsa: realtek: rtl8365mb: set and get vlan 4k for family D Mieczyslaw Nalewaj
2026-11-17  8:23     ` Linus Walleij
2026-11-18  1:48       ` Gustavo Foletto Mora
2026-11-18  7:59         ` Mieczyslaw Nalewaj
2026-11-19  1:47           ` Gustavo Foletto Mora
2026-11-19 22:36     ` netdev-bot+sashiko
2026-11-17  7:39   ` [PATCH net-next v11 08/13] net: dsa: realtek: rtl8365mb: refactor PVID handling Mieczyslaw Nalewaj
2026-11-17  8:34     ` Linus Walleij
2026-11-17  8:53       ` Mieczyslaw Nalewaj
2026-11-18  1:55     ` Gustavo Foletto Mora
2026-11-17  7:40   ` [PATCH net-next v11 09/13] net: dsa: realtek: rtl8365mb: use raw VID for PVID on family D Mieczyslaw Nalewaj
2026-11-18  2:00     ` Gustavo Foletto Mora
2026-11-19 22:36     ` netdev-bot+sashiko [this message]
2026-11-17  7:41   ` [PATCH net-next v11 10/13] net: dsa: realtek: rtl8365mb: add family D SDS13 PCS support Mieczyslaw Nalewaj
2026-11-19 22:36     ` netdev-bot+sashiko
2026-11-17  7:41   ` [PATCH net-next v11 11/13] net: dsa: realtek: rtl8365mb: refactor L2 MAC handling Mieczyslaw Nalewaj
2026-11-17  7:42   ` [PATCH net-next v11 12/13] net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D Mieczyslaw Nalewaj
2026-11-19 22:36     ` netdev-bot+sashiko
2026-11-17  7:43   ` [PATCH net-next v11 13/13] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-11-19 22:36     ` netdev-bot+sashiko

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=179512779167.3136.16350479075659467985@kernel.org \
    --to=netdev-bot+sashiko@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=linusw@kernel.org \
    --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=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