From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7706A1F0092B; Sat, 5 Dec 2026 22:19:43 +0000 (UTC) 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== Subject: Re: [PATCH net-next v20 09/15] net: dsa: realtek: rtl8365mb: use raw VID for PVID on family D 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 Date: Sat, 05 Dec 2026 22:19:43 +0000 Message-ID: <179650918301.3148.15125442557734641300@kernel.org> In-Reply-To: References: X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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