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
Subject: Re: [PATCH net-next v5 5/9] net: dsa: realtek: rtl8365mb: set and get vlan 4k for family D
Date: Wed, 14 Oct 2026 08:56:43 +0000	[thread overview]
Message-ID: <179196820369.434549.3311360668196397160@kernel.org> (raw)
In-Reply-To: <cf383ead-d169-4679-a4d0-028ea04d8a11@yahoo.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] On family D, rtl8365mb_vlan_4k_write()
  (drivers/net/dsa/realtek/rtl8365mb_vlan.c) sets…

--

net: dsa: realtek: rtl8365mb: set and get vlan 4k for family D

This commit gives family D its own two-word pack/unpack for CVLAN (VLAN 4K)
table entries, instead of reusing the three-word family C layout. It uses
a narrower 2-bit FID and drops the priority/meter fields. On write, it
forces both the IVL_EN and SVLAN_CHK_IVL_SVL bits to 1.

> diff --git a/drivers/net/dsa/realtek/rtl8365mb_vlan.c b/drivers/net/dsa/realtek/rtl8365mb_vlan.c
> index 8d49ffadce926..c2cfdf194aa9e 100644
> --- a/drivers/net/dsa/realtek/rtl8365mb_vlan.c
> +++ b/drivers/net/dsa/realtek/rtl8365mb_vlan.c

[ ... ]

> @@ -244,36 +290,61 @@ static int rtl8365mb_vlan_4k_write(struct realtek_priv *priv,
>  	val = FIELD_GET(RTL8365MB_CVLAN_UNTAG_LO_MASK, vlan4k->untag);
>  	data[0] |= FIELD_PREP(RTL8365MB_CVLAN_ENTRY_D0_UNTAG_MASK, val);
>
> -	data[1] |= FIELD_PREP(RTL8365MB_CVLAN_ENTRY_D1_FID_MASK, vlan4k->fid);

[ ... ]

> +	if (is_d) {
> +		/* The chip supports both IVL and SVL, but the caller (see
> +		 * rtl8365mb_vlan_4k_port_set()) never requests SVL, so both
> +		 * IVL/SVL selector bits are forced here rather than threaded
> +		 * through from vlan4k->ivl_en, which family C does honor.
> +		 * The vendor CVLAN API leaves SVLAN_CHK_IVL_SVL at 0, see the
> +		 * commit message.
> +		 */
> +		data[1] |= FIELD_PREP(RTL8365MB_D_CVLAN_ENTRY_D1_IVL_EN_MASK,
> +				      1) |
> +			   FIELD_PREP(RTL8365MB_D_CVLAN_ENTRY_D1_SVLAN_CHK_IVL_SVL_MASK,
> +				      1);

[Severity: Medium]
Should SVLAN_CHK_IVL_SVL be written as 1 in rtl8365mb_vlan_4k_write() on
family D?

The commit message says:

    The vendor RTL8367D CVLAN API leaves SVLAN_CHK_IVL_SVL
    at 0 and only sets it from the SVLAN member API; the value 1 has not been
    verified against the hardware with the bit cleared.

The reason given for forcing both bits is that the only caller always asks
for IVL:

drivers/net/dsa/realtek/rtl8365mb_vlan.c:rtl8365mb_vlan_4k_port_set() {
    ...
	vlan4k.ivl_en = true; /* always use Independent VLAN Learning */
    ...
}

That explains IVL_EN = 1, but does it explain the SVLAN bit? The vendor ties
that bit to SVLAN membership. This driver never configures SVLAN, and
RTL8365MB_D_CVLAN_ENTRY_D1_SVLAN_CHK_IVL_SVL_MASK is the only SVLAN-related
symbol under drivers/net/dsa/realtek/.

Even so, every bridge VLAN add or delete on a family D port sets the bit to
1:

rtl8365mb_vlan_4k_port_add()/rtl8365mb_vlan_4k_port_del()
  -> rtl8365mb_vlan_4k_port_set()
    -> rtl8365mb_vlan_4k_write()

This also covers entries whose member set becomes empty after the last
port is removed.

rtl8365mb_vlan_4k_read() never decodes this bit, so the read-modify-write
in rtl8365mb_vlan_4k_port_set() can't preserve whatever value the hardware
had.

If the bit has any effect, for example on how S-tagged traffic follows this
CVLAN entry's IVL/SVL setting, could learning or forwarding for matching
VIDs differ from what the vendor code produces?

Would it be safer to follow the vendor CVLAN path here? That would mean
writing SVLAN_CHK_IVL_SVL as 0 and deriving IVL_EN from vlan4k->ivl_en.

A related point about IVL_EN: on family D, rtl8365mb_vlan_4k_write()
ignores vlan4k->ivl_en, but rtl8365mb_vlan_4k_read() decodes it:

> +		vlan4k->ivl_en =
> +			FIELD_GET(RTL8365MB_D_CVLAN_ENTRY_D1_IVL_EN_MASK,
> +				  data[1]);

That asymmetry only does no harm because the single caller sets
ivl_en = true.

The code is unchanged at the end of the series, so this behavior ships with
the RTL8367S-VB enablement in "net: dsa: realtek: rtl8365mb: add support
for RTL8367S-VB".

> +		data[1] |= FIELD_PREP(RTL8365MB_D_CVLAN_ENTRY_D1_FID_MASK,
> +				      vlan4k->fid);

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/aa5fa12c-e43e-4e5e-9f77-c6eaf477abc4%40yahoo.com

  reply	other threads:[~2026-10-14  8:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <b45a3350-44a3-45ad-89cc-452c25edbd7d.ref@yahoo.com>
2026-10-13  8:23 ` [PATCH net-next v5 0/9] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-10-13  8:38   ` [PATCH net-next v5 1/9] dt-bindings: net: dsa: realtek: add RTL8367S-VB Mieczyslaw Nalewaj
2026-10-13  8:39   ` [PATCH net-next v5 2/9] net: dsa: realtek: rtl8365mb: add chip family infrastructure Mieczyslaw Nalewaj
2026-10-13 23:27     ` Linus Walleij
2026-10-13  8:40   ` [PATCH net-next v5 3/9] net: dsa: realtek: rtl8365mb: set speed for family D Mieczyslaw Nalewaj
2026-10-13  8:41   ` [PATCH net-next v5 4/9] net: dsa: realtek: rtl8365mb: set RGMII mode " Mieczyslaw Nalewaj
2026-10-14  8:56     ` netdev-bot+sashiko
2026-10-13  8:42   ` [PATCH net-next v5 5/9] net: dsa: realtek: rtl8365mb: set and get vlan 4k " Mieczyslaw Nalewaj
2026-10-14  8:56     ` netdev-bot+sashiko [this message]
2026-10-13  8:43   ` [PATCH net-next v5 6/9] net: dsa: realtek: rtl8365mb: use raw VID for PVID on " Mieczyslaw Nalewaj
2026-10-13  8:43   ` [PATCH net-next v5 7/9] net: dsa: realtek: rtl8365mb: add family D SDS13 PCS support Mieczyslaw Nalewaj
2026-10-14  8:56     ` netdev-bot+sashiko
2026-10-13  8:44   ` [PATCH net-next v5 8/9] net: dsa: realtek: rtl8365mb: re-latch the family D SerDes Mieczyslaw Nalewaj
2026-10-14  8:56     ` netdev-bot+sashiko
2026-10-13  8:45   ` [PATCH net-next v5 9/9] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-10-14  8: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=179196820369.434549.3311360668196397160@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --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