Article View: linux.kernel.netdev
Article #27532Re: [PATCH net-next v20 09/15] net: dsa: realtek: rtl8365mb: use raw VID for PVID on family D
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 22:19
Date: Sat, 05 Dec 2026 22:19
124 lines
12244 bytes
12244 bytes
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
Technical Details
Message-ID:
<179650918301.3148.15125442557734641300@kernel.org>Path:
mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378160-linux-kernel-netdev=dewy.ruReferences:
<a2d097bc-5ccc-4b7a-9917-7951b1dcd281@yahoo.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378160-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev 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 Organization: Usenet Network Message-ID: <179650918301.3148.15125442557734641300@kernel.org> References: <a2d097bc-5ccc-4b7a-9917-7951b1dcd281@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3132297"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:qAPWnJkYWLaDjtrbhVWN9P4tYyg= sha256:olXv/V+ebWhotiPUZvL4s92ztJEX2a4b/UgftMwPwgM= sha1:erf6ACzw7e2EQGNq6LmvG/kAU84= sha256:icW/XyyiEs3GhgYrJqCVNp+2BIinyfjZNbxr1uHVuls= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 2A676117EA0; Sun, 6 Dec 2026 01:20:10 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.539 X-Spam-Status: No, score=-3.539 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lay7hl2QeKXR; Sun, 6 Dec 2026 01:20:07 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-378160-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 59AEE117ED9; Sun, 6 Dec 2026 01:19:53 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 12539314C1; Sat, 5 Dec 2026 22:19:46 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796509185; b=5BGh8V0Z3G3aDuGXV9VNWIVkvRDOINKVT7JJUEViDj55Mxcq/VJojtwOl2DJ67M4S7Zp kTISp50LqFpB0N9LKn9UYfWm11qrvX9xXs59mN2OpSY5NSeAh6m2h4dEYXEayddCXBG3i YsI5FLJznq+7Fnv7bU8wmeLZO0iD8g2WRZK+Z2aDvIeGRu5YCZrqcdE5+rTAnrNDEkgqP fMxKTMitltVH94VGktnTIYV1rrJkYmsUrZigOWst7715Jne8QabVx92LeVXGPxVcdn0Cj Tiiao53Ale4xuLJC10mQE5MCRTbWnv2OJwz7zsROkluFJsOWgxBUQ674T+gjGu8k1vQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796509185; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=ruChhjuadWEFfZ9zphvsPZE/U7bD3CAdI4CS31T89bM=; b=S0aQZ86kkvsgSbcMKwtRtm5dgK7OpOoRBfaUnoPcCX8mTnbabYmXsYK1ljXF2ZxWBi19 3gxkvUvvXOG4U36QzD2V4t/qeDgIX042wdlEzTE6yof9V7U1vr/AbJnOcQaioVxZYz2H6 1HBhjdu4RpC+Cg9aDxOZlp79/W2bhH+HEZvj/hnJNdcFZxpLpZB/3OjLBEOwM7Ut9wn11 v2EvoV4rUeBauQOv2KDZHiiuXuEBLSzi7BruAhEE1qupNYxxtxLnpqVnxYM4INfSLZZhr S4lT8IAFGUlix8UjzD4xBnO+NAYSSNwNmk6AbOJ+wd3WeidNJYyV7pSK3e9sz4nO9Mw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NJM60v0s; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB22F606A330; Sat, 5 Dec 2026 22:19:45 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NJM60v0s X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796509185; b=BTAmCrEgiQ2Rm5cNdHNeFba2FqF6GF8N5jz+DszsB4/xnpZ98Po3pCvvonRkqBC16JfD jVNVQNBzUya+CBc+bzefzgbd4JYVrT9HK6DrnUhtse6aUH4nb4WFkMZfv32xm+yEkYnEV WGjAuhsWtKKyv6dsJt06M73dSnpZbkIS18ppRSbamgH7lHuji0mbtlLSQNtASNgY7zy3Z GleViB0pHLCCgB7k+sYthvCVjDuvTGpnZArnxg1nK1TgfUuknA2T263gXqczn5L5f+3ae zHD2Pw5Rm2r83/wfML2YfSKMXYSjZFotBlGagP6/56aXIEC2IWrzM66lhiejeyTr7Bw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796509185; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=ruChhjuadWEFfZ9zphvsPZE/U7bD3CAdI4CS31T89bM=; b=NuDMMA14bdq6KsT5WmVozsAjY2hMptZ7lJlc2gos9i/sO/hMvm/Z2D9jmMjurvq5DbMu RmTH6CRcwGEUG3oCKy7WACzS8cVVzFjOIdV7ScX6RL9xQQ0+ywBMHF5rSvfxaKFMQ814u cx6Dp/XukohQhIdwB6rJDqz5lM5jfMG2hfI+rfduLr26xRfLcLmHjewffof4s/phwZ4t0 PQGidQGydM71Nih7+shYwCwhkLYEo/zNMIU4p3xwyTqdqhiOdKT3eG8HAmZoY0j6i7WuK Vih5obF2tT6luXVXG/Ako+Bc1tLjYkMzWizufuDRMhW3TZNwPuqBJz9MKymk0mtricw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NJM60v0s; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05CB3606A32F; Sat, 5 Dec 2026 22:19:44 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7706A1F0092B; Sat, 5 Dec 2026 22:19:43 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796509184; bh=ruChhjuadWEFfZ9zphvsPZE/U7bD3CAdI4CS31T89bM=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=NJM60v0sR8o6u517oPJ8m6BiF4jjZ+d7NoDVcGkTAc+dCC7RFzKxYtFnu2Qw97P0M cyVMuYlpSj+i0bdzkLMgcwCA6y6daw0/h4WNahpTUbzM+VwhXQmzEAdYqCTMgMMtZH agw5dzDSNqFd9NvlLdj2OAglcx6ofG/LMLYe1oakNqYskrSn679B+BRWlqgADkaPyf +zl+7PWeOqsLJhJ2mdX0PngzwRfCOTSqPTcoKXjftqHQhn1ElOZdqEQyGGzrmwI4k2 DzG7j970LP9y0nR+ub9wMtdLDI7dlTmQGQaHGfLuO9aPdmLqYxWW7hJvMnv4a3ZJ7q KIJ4A4mbDdiiw== X-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 X-In-Reply-To: <a2d097bc-5ccc-4b7a-9917-7951b1dcd281@yahoo.com> X-sashiko-severity: Low X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list