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 v10 08/12] net: dsa: realtek: rtl8365mb: use raw VID for PVID on family D
Date: Mon, 16 Nov 2026 18:55:56 +0000	[thread overview]
Message-ID: <179485535671.3136.12858129949728945036@kernel.org> (raw)
In-Reply-To: <24c9870b-1991-4817-90a4-e41c5bcac09d@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 kernel-doc of the new rtl8365mb_vlan_port_reset_pvid()
  (drivers/net/dsa/realtek/rtl8365mb_vlan.c) gives two reasons that…
- [Low] net: dsa: realtek: PVID helpers use rtl8365mb_is_d() instead of
  family ops

--

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

This patch changes the rtl8365mb PVID helpers so that, on family D, they
use a raw 12-bit VID in the per-port register at 0x0700 + port, because
family D has no VLAN MC table. It also adds
rtl8365mb_vlan_port_reset_pvid(), which rtl8365mb_vlan_setup() calls to
clear the family D PVID registers at setup time. Family C behaviour is
meant to stay the same.

> diff --git a/drivers/net/dsa/realtek/rtl8365mb_main.c b/drivers/net/dsa/realtek/rtl8365mb_main.c
> index 07e0486060ff0..1c2a998695d6d 100644
> --- a/drivers/net/dsa/realtek/rtl8365mb_main.c
> +++ b/drivers/net/dsa/realtek/rtl8365mb_main.c
> @@ -2420,6 +2420,15 @@ static int rtl8365mb_vlan_setup(struct dsa_switch *ds)
>  	int ret;
>  
>  	dsa_switch_for_each_available_port(dp, ds) {
> +		/* Start every port with the neutral PVID */
> +		ret = rtl8365mb_vlan_port_reset_pvid(priv, dp->index);
> +		if (ret) {
> +			dev_err(priv->dev,
> +				"Failed to reset PVID on port %d\n",
> +				dp->index);
> +			return ret;
> +		}
> +

[Severity: Low]
This still dispatches on rtl8365mb_is_d() inside the family C helpers.
rtl8365mb_vlan_port_get_pvid() now holds two implementations that share
nothing but the signature. rtl8365mb_vlan_pvid_port_set() and
rtl8365mb_vlan_pvid_port_clear() each start with an early return into a
_direct variant. rtl8365mb_vlan_port_reset_pvid() is a no-op unless the
chip is family D.

Luiz raised these points on v7. He asked why rtl8365mb_vlan_setup()
needs a separate reset helper when the PVID clear path already exists.
He asked for rtl8365mb_vlan_port_get_pvid() not to lump both families
into one if/else. He pointed out that VLANMC index 0 is a driver
convention (VID 0) rather than a hardware neutral PVID. He also said
the _direct suffix is not meaningful, and that family-specific
implementations with the same signatures would be cleaner. I don't see
these points addressed or answered in this version.

v10 already moved vlan_4k_read()/vlan_4k_write() and the l2_* entry
converters behind callbacks in struct rtl8365mb_family_info. Could the
PVID get, set, clear and setup-time reset go through the same family
ops, with separate family C and family D functions? That would also
avoid adding another rtl8365mb_is_d() branch to each of these helpers
when the next family shows up.

If there is a reason to keep the branches as they are, could you reply
to the v7 comments or note it in the commit message?

[ ... ]

> diff --git a/drivers/net/dsa/realtek/rtl8365mb_vlan.c b/drivers/net/dsa/realtek/rtl8365mb_vlan.c
> index bf1a6a9916114..7d805c6ab5837 100644
> --- a/drivers/net/dsa/realtek/rtl8365mb_vlan.c
> +++ b/drivers/net/dsa/realtek/rtl8365mb_vlan.c

[ ... ]

> @@ -773,14 +782,51 @@ int rtl8365mb_vlan_port_get_pvid(struct realtek_priv *priv, int port, u16 *pvid)

[ ... ]

> +/**
> + * rtl8365mb_vlan_port_reset_pvid() - Put a port's PVID in its neutral state
> + * @priv: realtek_priv pointer
> + * @port: the port number
> + *
> + * On family C the neutral PVID is VLANMC index 0, which is the reset value, so
> + * there is nothing to do. 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.
> + *
> + * Context: Can sleep.
> + * Return: 0 on success, or a negative error code on failure.
> + */
> +int rtl8365mb_vlan_port_reset_pvid(struct realtek_priv *priv, int port)
> +{
> +	if (!rtl8365mb_is_d(priv))
> +		return 0;

[Severity: Low]
The two halves of this kernel-doc don't seem to agree. Family D gets
cleared because its value after reset "may come from the hardware default
or from an EEPROM". Family C is assumed to be at VLANMC index 0 because
that is "the reset value".

The file header in rtl8365mb_main.c says the EEPROM applies to every chip
the driver handles:

 * The EEPROM contains initial register values which the chip will read over I2C
 * upon hardware reset. It is also possible to omit the EEPROM.

Both families also use the same PVID register block:

#define RTL8365MB_VLAN_PVID_CTRL_BASE			0x0700
...
#define RTL8365MB_D_VLAN_PVID_CTRL_BASE			0x0700

Is there something that prevents the family C MCIDX fields and VLANMC
entries from being loaded from EEPROM as well?

Suppose a family C EEPROM programs a non-zero MC index and a matching
VLANMC entry. Then rtl8365mb_vlan_setup() leaves it in place, even though
its comment says "Start every port with the neutral PVID". Later:

rtl8365mb_port_vlan_filtering(ds, port, true, ...)
    rtl8365mb_vlan_port_get_pvid()
        -> returns the stale vlanmc.evid
    accepted_frame = RTL8365MB_FRAME_TYPE_ANY_FRAME;

Wouldn't that accept untagged frames on a port the driver never
configured? The commit message gives this same case as the reason to
clear family D.

Family C never cleared these registers before, so "No functional change
for family C" is accurate. The final tree in the series still returns
early here for family C.

Could this either write MC index 0 for family C too (index 0 is
documented as the reserved neutral PVID), or explain in the comment why
the family C PVID registers are known not to be loaded from EEPROM?

> +
> +	return regmap_update_bits(priv->map,
> +				  RTL8365MB_D_VLAN_PVID_CTRL_REG(port),
> +				  RTL8365MB_D_VLAN_PVID_CTRL_MASK, 0);
> +}

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/d9da17af-f49e-4878-a8dd-59a8919e6930%40yahoo.com

  reply	other threads:[~2026-11-16 18:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <d9da17af-f49e-4878-a8dd-59a8919e6930.ref@yahoo.com>
2026-11-12 17:31 ` [PATCH net-next v10 00/12] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-11-12 17:32   ` [PATCH net-next v10 01/12] dt-bindings: net: dsa: realtek: add RTL8367S-VB Mieczyslaw Nalewaj
2026-11-12 17:33   ` [PATCH net-next v10 02/12] net: dsa: realtek: rtl8365mb: add chip family infrastructure Mieczyslaw Nalewaj
2026-11-12 17:33   ` [PATCH net-next v10 03/12] net: dsa: realtek: rtl8365mb: refactor forcemode handling Mieczyslaw Nalewaj
2026-11-12 20:23     ` Linus Walleij
2026-11-12 17:34   ` [PATCH net-next v10 04/12] net: dsa: realtek: rtl8365mb: set speed for family D Mieczyslaw Nalewaj
2026-11-12 17:35   ` [PATCH net-next v10 05/12] net: dsa: realtek: rtl8365mb: set RGMII mode " Mieczyslaw Nalewaj
2026-11-12 17:36   ` [PATCH net-next v10 06/12] net: dsa: realtek: rtl8365mb: refactor VLAN 4k handling Mieczyslaw Nalewaj
2026-11-12 20:24     ` Linus Walleij
2026-11-12 17:37   ` [PATCH net-next v10 07/12] net: dsa: realtek: rtl8365mb: set and get vlan 4k for family D Mieczyslaw Nalewaj
2026-11-12 20:25     ` Linus Walleij
2026-11-16 18:55     ` netdev-bot+sashiko
2026-11-12 17:38   ` [PATCH net-next v10 08/12] net: dsa: realtek: rtl8365mb: use raw VID for PVID on " Mieczyslaw Nalewaj
2026-11-16 18:55     ` netdev-bot+sashiko [this message]
2026-11-12 17:39   ` [PATCH net-next v10 09/12] net: dsa: realtek: rtl8365mb: add family D SDS13 PCS support Mieczyslaw Nalewaj
2026-11-16 18:55     ` netdev-bot+sashiko
2026-11-12 17:40   ` [PATCH net-next v10 10/12] net: dsa: realtek: rtl8365mb: refactor L2 MAC handling Mieczyslaw Nalewaj
2026-11-12 20:26     ` Linus Walleij
2026-11-12 17:41   ` [PATCH net-next v10 11/12] net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D Mieczyslaw Nalewaj
2026-11-16 18:55     ` netdev-bot+sashiko
2026-11-12 17:42   ` [PATCH net-next v10 12/12] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-11-16 18:56     ` 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=179485535671.3136.12858129949728945036@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