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,
o.rempel@pengutronix.de
Subject: Re: [PATCH net-next v20 09/15] net: dsa: realtek: rtl8365mb: use raw VID for PVID on family D
Date: Sat, 05 Dec 2026 22:19:43 +0000 [thread overview]
Message-ID: <179650918301.3148.15125442557734641300@kernel.org> (raw)
In-Reply-To: <a2d097bc-5ccc-4b7a-9917-7951b1dcd281@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] In rtl8365mb_d_vlan_pvid_port_set()
(drivers/net/dsa/realtek/rtl8365mb_vlan.c), the function saves…
--
net: dsa: realtek: rtl8365mb: use raw VID for PVID on family D
This 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, and these
helpers skip the VLAN MC table. It also clears the family D PVID
registers during VLAN setup.
> diff --git a/drivers/net/dsa/realtek/rtl8365mb_vlan.c b/drivers/net/dsa/realtek/rtl8365mb_vlan.c
> index 1463d5f469a6d..58e1c24213b66 100644
> --- a/drivers/net/dsa/realtek/rtl8365mb_vlan.c
> +++ b/drivers/net/dsa/realtek/rtl8365mb_vlan.c
[ ... ]
> +int rtl8365mb_d_vlan_pvid_port_set(struct dsa_switch *ds, int port, u16 vid,
> + struct netlink_ext_ack *extack)
> +{
> + enum rtl8365mb_frame_ingress prev_accepted_frame;
> + struct realtek_priv *priv = ds->priv;
> + u32 prev_pvid;
> + int ret;
> +
> + lockdep_assert_held(&priv->vlan_lock);
> +
> + ret = regmap_read(priv->map, RTL8365MB_D_VLAN_PVID_CTRL_REG(port),
> + &prev_pvid);
> + if (ret) {
> + dev_err(priv->dev, "Failed to read current PVID\n");
> + return ret;
> + }
> + prev_pvid &= RTL8365MB_D_VLAN_PVID_CTRL_MASK;
> +
> + ret = rtl8365mb_vlan_port_get_framefilter(priv, port,
> + &prev_accepted_frame);
> + if (ret) {
> + dev_err(priv->dev, "Failed to get current framefilter\n");
> + return ret;
> + }
> +
> + ret = regmap_update_bits(priv->map,
> + RTL8365MB_D_VLAN_PVID_CTRL_REG(port),
> + RTL8365MB_D_VLAN_PVID_CTRL_MASK,
> + vid & RTL8365MB_D_VLAN_PVID_CTRL_MASK);
> + if (ret) {
> + dev_err(priv->dev, "Failed to set port PVID\n");
> + return ret;
> + }
[Severity: Low]
Should this error path also write prev_pvid back to the PVID register?
The driver already says elsewhere that a failed write may still have
taken effect. From rtl8365mb_vlan_4k_port_set():
/* The write may reach the chip even if an error is reported, so mark
* a populated entry as used before writing it.
*/
Both transports allow this. realtek_smi_write_reg() clocks out the data
bytes before the final ACK check can fail. In realtek_mdio_write() the
error can come from the last CTRL1 write.
If that happens, the register holds the new VID but the call returns an
error. The caller, rtl8365mb_port_vlan_add(), does not undo anything:
ret = rtl8365mb_vlan_pvid_port_set(ds, port, vlan->vid,
extack);
if (ret)
goto out_unlock;
So the bridge still thinks the old PVID is set. If the port was already
in ANY_FRAME mode (filtering off, or a PVID already set), can untagged
ingress frames then be classified into a VID the bridge never set as
PVID?
A later rtl8365mb_d_vlan_pvid_port_clear() for the old PVID would read
the new VID and return early here:
/* Port is not using this VID as PVID. Nothing to remove. */
if ((cur_pvid & RTL8365MB_D_VLAN_PVID_CTRL_MASK) != vid)
return 0;
That would leave the wrong value in the register.
The undo_pvid_write label only covers the later frame filter failure.
The family C version does not restore the MC index in this case either,
so this matches the existing best-effort rollback.
> +
> + /* Changing accept frame is what enables PVID (if not enabled before) */
> + ret = rtl8365mb_vlan_port_set_framefilter(priv, port,
> + RTL8365MB_FRAME_TYPE_ANY_FRAME);
> + if (ret) {
> + dev_err(priv->dev, "Failed to set port frame filter\n");
> + goto undo_pvid_write;
> + }
> +
> + return 0;
> +
> +undo_pvid_write:
> + (void)regmap_update_bits(priv->map,
> + RTL8365MB_D_VLAN_PVID_CTRL_REG(port),
> + RTL8365MB_D_VLAN_PVID_CTRL_MASK, prev_pvid);
> + (void)rtl8365mb_vlan_port_set_framefilter(priv, port,
> + prev_accepted_frame);
> + return ret;
> +}
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/9efcb80a-517c-4413-8261-4f9380e0eb83%40yahoo.com
next prev parent reply other threads:[~2026-12-05 22:19 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <9efcb80a-517c-4413-8261-4f9380e0eb83.ref@yahoo.com>
2026-12-04 22:01 ` [PATCH net-next v20 00/15] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-12-04 22:03 ` [PATCH net-next v20 01/15] dt-bindings: net: dsa: realtek: add RTL8367S-VB Mieczyslaw Nalewaj
2026-12-04 22:03 ` [PATCH net-next v20 02/15] net: dsa: realtek: rtl8365mb: add chip family infrastructure Mieczyslaw Nalewaj
2026-12-04 22:04 ` [PATCH net-next v20 03/15] net: dsa: realtek: rtl8365mb: refactor forcemode handling Mieczyslaw Nalewaj
2026-12-04 22:04 ` [PATCH net-next v20 04/15] net: dsa: realtek: rtl8365mb: set speed for family D Mieczyslaw Nalewaj
2026-12-04 22:04 ` [PATCH net-next v20 05/15] net: dsa: realtek: rtl8365mb: set RGMII mode " Mieczyslaw Nalewaj
2026-12-04 22:04 ` [PATCH net-next v20 06/15] net: dsa: realtek: rtl8365mb: refactor VLAN 4k handling Mieczyslaw Nalewaj
2026-12-04 22:04 ` [PATCH net-next v20 07/15] net: dsa: realtek: rtl8365mb: add VLAN 4k/IVL for family D Mieczyslaw Nalewaj
2026-12-05 22:19 ` netdev-bot+sashiko
2026-12-04 22:06 ` [PATCH net-next v20 08/15] net: dsa: realtek: rtl8365mb: refactor PVID handling Mieczyslaw Nalewaj
2026-12-04 22:07 ` [PATCH net-next v20 09/15] net: dsa: realtek: rtl8365mb: use raw VID for PVID on family D Mieczyslaw Nalewaj
2026-12-05 22:19 ` netdev-bot+sashiko [this message]
2026-12-04 22:07 ` [PATCH net-next v20 10/15] net: dsa: realtek: rtl8365mb: add family D SDS13 PCS support Mieczyslaw Nalewaj
2026-12-04 22:07 ` [PATCH net-next v20 11/15] net: dsa: realtek: rtl8365mb: refactor L2 MAC handling Mieczyslaw Nalewaj
2026-12-04 22:07 ` [PATCH net-next v20 13/15] net: dsa: realtek: rtl8365mb: refactor QoS priority handling Mieczyslaw Nalewaj
2026-12-04 22:07 ` [PATCH net-next v20 12/15] net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D Mieczyslaw Nalewaj
2026-12-05 22:19 ` netdev-bot+sashiko
2026-12-04 22:07 ` [PATCH net-next v20 15/15] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-12-04 22:08 ` [PATCH net-next v20 14/15] net: dsa: realtek: rtl8365mb: use PCP numbering on family D Mieczyslaw Nalewaj
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=179650918301.3148.15125442557734641300@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=o.rempel@pengutronix.de \
--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