Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: luizluca@gmail.com
Cc: Jakub Kicinski <kuba@kernel.org>,
	andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net,
	edumazet@google.com, pabeni@redhat.com, horms@kernel.org,
	linusw@kernel.org, alsi@bang-olufsen.dk, yury.norov@gmail.com,
	linux@rasmusvillemoes.dk, linux@armlinux.org.uk,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [net-next PATCH v3 5/8] net: dsa: realtek: rtl8365mb: add VLAN support
Date: Sun, 10 May 2026 10:35:12 -0700	[thread overview]
Message-ID: <20260510173512.3920005-1-kuba@kernel.org> (raw)
In-Reply-To: <20260506-realtek_forward-v3-5-1d87c5f85a3b@gmail.com>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
Note: The format of this review has been altered to use a free-form summary of the findings rather than inline code quotes due to recitation restrictions.

commit 2401182ef461b16c2b0ffe98288b5a310381d0f7
Author: Alvin Šipraga <alsi@bang-olufsen.dk>
Subject: net: dsa: realtek: rtl8365mb: add VLAN support

This commit adds VLAN support for the RTL8365MB switch family. It implements a dynamic allocation scheme to manage both the full 4096-entry VLAN4K table and the smaller 32-entry VLANMC table, keeping them synchronized and allocating VLANMC entries primarily for PVID assignment.

When configuring a port's PVID, rtl8365mb_vlan_pvid_port_add() allocates a new VLANMC entry. However, if a user changes a port's PVID, does the driver leak the old PVID's hardware slot? In rtl8365mb_vlan_pvid_port_del(), the driver reads the port's current PVID and returns early if it no longer matches the deleted VLAN. Since the hardware is strictly limited to 31 VLANMC entries, it seems repeatedly changing PVIDs could permanently exhaust the table and result in -E2BIG errors.

In rtl8365mb_vlan_mc_read(), the driver extracts the member, fid, priority, and evid fields, but appears to leave meteridx, policing_en, and priority_en uninitialized. When modifying an existing entry, rtl8365mb_vlan_mc_port_set() passes a partially zero-initialized stack structure to rtl8365mb_vlan_mc_write(). Does this unintentionally clear those fields in the hardware register during write-back?

The commit message states that the driver keeps membership configurations in sync when a corresponding entry exists in VLANMC. However, rtl8365mb_port_vlan_add() only calls the PVID add function if the pvid flag is true. If a port is added as a non-PVID member to a VLAN that already has an active MC entry, it seems the port is only added to the VLAN4K table. Does this leave the VLANMC member mask permanently desynchronized from the actual VLAN membership?

In rtl8365mb_port_vlan_filtering(), the driver iterates through available ports to set the transparent mode. If rtl8365mb_port_set_transparent() fails midway, the function returns immediately. A similar pattern exists in rtl8365mb_vlan_pvid_port_del(), where it modifies the port frame filter and PVID before calling rtl8365mb_vlan_mc_port_set(). Could these early returns leave the switch in an inconsistent state? It looks like they might benefit from proper error unwinding to revert the successful register modifications.

When searching for an empty VLANMC slot, rtl8365mb_vlan_mc_find() checks if the evid is 0x0. If a port is explicitly configured to use VLAN 0, perhaps for 802.1p priority tagging, could this active configuration be mistakenly identified as an empty slot? It seems this might cause a newly configured PVID to silently overwrite the active VLAN 0 configuration. Would checking the member mask alongside the evid help prevent this?

This isn't a bug, but in rtl8365mb_vlan_port_set_framefilter(), the accepted_frame argument is typed as an enum rtl8365mb_frame_ingress, but it is bit-shifted and reassigned to itself. Could this trigger static analyzer warnings about assigning a shifted integer back into an enum variable? Using a separate u32 variable for the shifted mask might be safer.

  parent reply	other threads:[~2026-05-10 17:35 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07  2:58 [net-next PATCH v3 0/8] net: dsa: realtek: rtl8365mb: bridge offloading and VLAN support Luiz Angelo Daros de Luca
2026-05-07  2:58 ` [net-next PATCH v3 1/8] net: dsa: realtek: rtl8365mb: use ERR_PTR Luiz Angelo Daros de Luca
2026-05-10 15:23   ` Mieczyslaw Nalewaj
2026-05-07  2:58 ` [net-next PATCH v3 2/8] net: dsa: realtek: rtl8365mb: use dsa helpers for port iteration Luiz Angelo Daros de Luca
2026-05-10 15:23   ` Mieczyslaw Nalewaj
2026-05-10 17:34   ` Jakub Kicinski
2026-05-10 17:35   ` Jakub Kicinski
2026-05-07  2:58 ` [net-next PATCH v3 3/8] net: dsa: realtek: rtl8365mb: prepare for multiple source files Luiz Angelo Daros de Luca
2026-05-10 15:23   ` Mieczyslaw Nalewaj
2026-05-07  2:58 ` [net-next PATCH v3 4/8] net: dsa: realtek: rtl8365mb: add table lookup interface Luiz Angelo Daros de Luca
2026-05-10 15:24   ` Mieczyslaw Nalewaj
2026-05-10 17:34   ` Jakub Kicinski
2026-05-07  2:58 ` [net-next PATCH v3 5/8] net: dsa: realtek: rtl8365mb: add VLAN support Luiz Angelo Daros de Luca
2026-05-10 15:24   ` Mieczyslaw Nalewaj
2026-05-10 17:34   ` Jakub Kicinski
2026-05-10 17:35   ` Jakub Kicinski [this message]
2026-05-07  2:58 ` [net-next PATCH v3 6/8] net: dsa: realtek: rtl8365mb: add port_bridge_{join,leave} Luiz Angelo Daros de Luca
2026-05-10 15:25   ` Mieczyslaw Nalewaj
2026-05-10 17:34   ` Jakub Kicinski
2026-05-10 17:35   ` Jakub Kicinski
2026-05-07  2:58 ` [net-next PATCH v3 7/8] net: dsa: realtek: rtl8365mb: add FDB support Luiz Angelo Daros de Luca
2026-05-10 15:25   ` Mieczyslaw Nalewaj
2026-05-10 17:34   ` Jakub Kicinski
2026-05-10 17:35   ` Jakub Kicinski
2026-05-11 15:00     ` Mieczyslaw Nalewaj
2026-05-07  2:58 ` [net-next PATCH v3 8/8] net: dsa: realtek: rtl8365mb: add bridge port flags Luiz Angelo Daros de Luca
2026-05-10 15:26   ` Mieczyslaw Nalewaj
2026-05-10 17:34   ` Jakub Kicinski
2026-05-10 17:34 ` [net-next PATCH v3 0/8] net: dsa: realtek: rtl8365mb: bridge offloading and VLAN support Jakub Kicinski
2026-05-11  4:58   ` Luiz Angelo Daros de Luca
2026-05-11  9:31     ` Linus Walleij

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=20260510173512.3920005-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=alsi@bang-olufsen.dk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=linux@rasmusvillemoes.dk \
    --cc=luizluca@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=yury.norov@gmail.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