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=1796509183; b=OyFjzxm8pSXyccBHASG+hI9wx5sBMCAgxGYgx1BM6fZQGXSYVH/1T7sbydgcnHvWnR9m j4/u3Z7xLchmvJn54AR1u8LoHomck1+N3px26G4EQbeVTd67p/OUmYdpIWJ5nTZrHBNyx FiRwmnj0l26hPwnalz0BQ5T0MgR7TaFpyRxdmc+E5Mc3iccx4jOGJ8ennMqoYARk8Q690 DKNDMbWRMY2iZyrjgG3w5KVVCUeczV685zzsZwn04PW+7RsncZ8/P6fPlWlX6BIxe1f5m mOqJMpWG4Q6IRpREycwPr2splfYRDOxuwZ6BXUVzCYGZdqVicQnBjNRInCsETogKnJA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796509183; 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=9vjvp3Ubj7BzUvmX/wcP+SEm/4Lule5SRIw/keZP6yo=; b=gTLFtp8zdDmWsF6bFJHtK12ZX7IABfEakF0G0/uDUwd5/VU/0r61ELjjw7djMAMQZloT Wcs26MYGv2NEFYucBv20pQZy+nR+PNZwEyIr1K4IH/By5dOj1TFbEcDbr6YUao2VC86Fd 1VJkfCpQqTHr0PL7xKYaO8Mc2X7ii3FCdDG4xlihypN5/DTX7LwfkvBYYj1hcJnuxSc9l Cf+iZJz7YrWSOltinzn+1BPk3H7uhy7h2E2uPJy4QDPOjERKRVJ9+G+WdjyoAIp9K4YJr xUbAOox2gMaXzi39WLnOeWXskVFFAHCUl+r6rGMrX8yuTN52VNjf+Dfw2HA3CXDkAbQ== 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=MjCN8CfU; 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 F0C41606A31F; Sat, 5 Dec 2026 22:19:42 +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=MjCN8CfU Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD21A1F0092B; Sat, 5 Dec 2026 22:19:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796509182; bh=9vjvp3Ubj7BzUvmX/wcP+SEm/4Lule5SRIw/keZP6yo=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=MjCN8CfUFNcB2UwLEXmypqYkGi3bI8bIUafrqi2fi7OAQdWs7+vnNWQiHtEfJ8Uzv GmlxAHwMzIb1epjklnoQg9kpusE2W0MZMxxAe/x8z5atRMSfkhGzTVRTKv+9w23cL5 acporOwHwAQP/ZP/YpruUvi8hNMsu+94VDKbvUhD1uMpLCV1sE3nMa+tpSbEeGNx5R Rqyix6K4iAyKwMX98k54Rf3RE+M3I+R9t81Yv6rgx8vhyBM18M1vpYDfu83uRYkoaA TlNhcjSQFRTt9mP9sjJuUmr2gT69WZDEJ7tT7Buw7W9mlxrM4G9WLesMW93dR6K0M8 rrpanrXgr7QhQ== Subject: Re: [PATCH net-next v20 07/15] net: dsa: realtek: rtl8365mb: add VLAN 4k/IVL for 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:41 +0000 Message-ID: <179650918127.3148.1881403400668275590@kernel.org> In-Reply-To: <71391a28-8df8-45a8-9705-07f2c5454e85@yahoo.com> References: <71391a28-8df8-45a8-9705-07f2c5454e85@yahoo.com> X-sashiko-severity: Medium 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 2 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 1 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 the driver infers the switch-wide IVL state actually programmed in the 4K table from software flags:… - [Low] Concern: after the switch-wide IVL_EN flip in rtl8365mb_d_vlan_4k_set_ivl(), only dynamic entries are flushed… -- net: dsa: realtek: rtl8365mb: add VLAN 4k/IVL for family D This adds two-word CVLAN pack/unpack helpers for the family D chips. It also makes IVL_EN in the 4K VLAN table follow a switch-wide policy: IVL while any user port is VLAN filtering, SVL otherwise. A vlan_filtering change that flips the policy rewrites IVL_EN on the VIDs tracked in a new vlan_4k_used bitmap, then flushes dynamic L2 entries on all user ports. > diff --git a/drivers/net/dsa/realtek/rtl8365mb_vlan.c b/drivers/net/dsa/realtek/rtl8365mb_vlan.c > index 566c6bc1449af..ca2815bc42bbd 100644 > --- a/drivers/net/dsa/realtek/rtl8365mb_vlan.c > +++ b/drivers/net/dsa/realtek/rtl8365mb_vlan.c [ ... ] > +/* Set IVL_EN of every 4K entry in use to @want_ivl. Callers must use it only > + * for a change of the switch-wide state (see > + * rtl8365mb_d_vlan_4k_refresh_ivl()), so that every entry in use holds > + * !@want_ivl on entry. Must be called with &priv->vlan_lock held. > + */ > +static int rtl8365mb_d_vlan_4k_set_ivl(struct dsa_switch *ds, bool want_ivl) > +{ [ ... ] > + for_each_set_bit(vid, priv->vlan_4k_used, VLAN_N_VID) { > + ret = fi->vlan_4k_read(priv, vid, &vlan4k); > + if (ret) > + goto rollback; > + if (!vlan4k.member || vlan4k.ivl_en == want_ivl) > + continue; > + > + vlan4k.ivl_en = want_ivl; > + ret = fi->vlan_4k_write(priv, &vlan4k); > + if (ret) > + goto rollback; > + } > + > + dsa_switch_for_each_user_port(dp, ds) > + rtl83xx_port_fast_age(ds, dp->index); [Severity: Low] This isn't a bug, but rtl83xx_port_fast_age() goes through rtl8365mb_l2_flush(), which only removes dynamic entries (RTL8365MB_L2_FLUSH_CTRL2_TYPE_DYNAMIC). Static FDB/MDB entries survive the IVL_EN flip. In the family D L2 helpers later in the series, the static key comes from the VID and not from the switch-wide policy: rtl8365mb_d_l2_uc_to_data() { ... bool ivl = uc->key.ivl && uc->key.vid; ... } So VID 0 entries stay SVL with FID 1, VID N entries stay IVL, and this matches the software bridge lookup across a toggle. Someone reading this code could take it for a missing static flush. Could a short comment here say that static entries are kept on purpose? > + > + return 0; > + > +rollback: > + /* Best effort: restore IVL_EN on the entries rewritten so far (without > + * flushing L2 entries). IVL_EN is switch-wide, so before the scan > + * every entry in use had the old value (!want_ivl) and every entry > + * below @failed that now has want_ivl was rewritten above. The entry > + * that failed is included: its write may have reached the chip before > + * the error was reported. > + */ > + failed = vid + 1; > + for_each_set_bit(vid, priv->vlan_4k_used, failed) { > + if (fi->vlan_4k_read(priv, vid, &vlan4k)) { > + dev_warn(priv->dev, "VID %u: IVL_EN rollback read failed\n", > + vid); > + continue; > + } > + if (!vlan4k.member || vlan4k.ivl_en != want_ivl) > + continue; > + vlan4k.ivl_en = !want_ivl; > + if (fi->vlan_4k_write(priv, &vlan4k)) > + dev_warn(priv->dev, "VID %u: IVL_EN rollback failed\n", > + vid); > + } > + return ret; > +} > + > +/* Must be called with &priv->vlan_lock held. */ > +int rtl8365mb_d_vlan_4k_refresh_ivl(struct dsa_switch *ds, int port, > + bool filtering) > +{ > + bool want_ivl = rtl8365mb_d_want_ivl(ds, port, filtering); > + > + /* The scan visits every entry in use, so do it only if this > + * change flips the switch-wide state, not for each port of a bridge. > + */ > + if (want_ivl == rtl8365mb_d_want_ivl(ds, -1, false)) > + return 0; [Severity: Medium] Can the IVL_EN state in the 4K table drift away from what rtl8365mb_d_want_ivl(ds, -1, false) reports here? The current state is derived from dsa_port_is_vlan_filtering() on each user port. It is not taken from what was actually written to the table. dsa_port_vlan_filtering() in net/dsa/port.c can succeed in port_vlan_filtering(new), which flips all used entries, and then fail in dsa_user_manage_vlan_filtering(). When that happens it does: restore: ds->ops->port_vlan_filtering(ds, dp->index, old_vlan_filtering, NULL); if (ds->vlan_filtering_is_global) ds->vlan_filtering = old_vlan_filtering; else dp->vlan_filtering = old_vlan_filtering; The return value of the restore call is ignored. The restore call can fail in two ways: - rtl8365mb_port_vlan_filtering(old) fails before it reaches rtl8365mb_d_vlan_4k_refresh_ivl(), for example on the framefilter, PVID or egress mode register accesses. - set_ivl(old) fails part way and its rollback puts the entries back to the new value. In both cases the table keeps the new IVL_EN while dp->vlan_filtering goes back to the old value. The rollback loop above can also leave single entries at want_ivl when one of its reads or writes fails. It only warns in that case. After that, rtl8365mb_vlan_4k_port_set() writes new and changed entries with: vlan4k.ivl_en = vlan4k.member && rtl8365mb_d_want_ivl(ds, -1, false); Wouldn't the table then hold a mix of SVL and IVL entries? For some VLANs, the key the chip learns with would no longer match the VID-derived static FDB/MDB key that the family D L2 helpers use. The invariant in the rtl8365mb_d_vlan_4k_set_ivl() comment, "every entry in use holds !@want_ivl on entry", would also stop holding. The table seems to recover only after a later successful toggle in the same direction flips the remaining entries. Would it make sense to record the IVL_EN state that was last programmed successfully, and compare against that instead? -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/9efcb80a-517c-4413-8261-4f9380e0eb83%40yahoo.com