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=1796051566; b=Hdch+eeUqNNeTuH5R13twcBOmihEp0U0E5ktU+qhzU5DPU3kkpCbchGI78chkXdQY/lg /CPvud0pINU3Sj6upnuRfp3OJ6OlMF5llp6vsIXWNF2H3ds34GyuHPtttiS55xA4iczeB Fmhz1q6qTCqJnkWKK1ugaHmXLOUru0cW+6yuP4jeVP5AhWG5tBbj7DC91+/zAu2+PMt4x U5ntrTPiqnj0/4bUO00bdh+SvSTzoPWfTE2fQb2njVlO79PQLZJaHksdl1hj9y3wBG3RD Zoq+f3e/fq5k6JUIe74fz4DRIgrdVEMTdSQjkxM/zmrPlinl3feXeMv6PTwfGylP8JA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796051566; 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=JRYUi31wR+P/vOfP920/RFQ+pGiXW1it1lYMWtw5yO8=; b=ecUo6wWk/WgRLbiz25jXBb6h7qm1Xl4ak6XzcsvVWZdka2RvnRco2H56CczrizTZhgqc oRyXa5uSx1yOQIG9QWm2ufP7agQT8n0pswv1t9JGkP0LaO+qtCdifC9Hmymis2u+AfEHE lvcbqJjjjO15DmbrYrNUiLQDWTVfDDP7qARnmIvy/6XMQSNTdxTuJ5juN93/DPi5czmXX 5NRkQzXN9oAL6NeDgwYKLOguR+dViFPbJtL31EDuVlNQrSJEHFGldyKG1ML6IXz4QtjVR 6xRFNgCyzSfah9X2qTjFaCxd5pG+BrxxAikJHDfc/kTogBfbLZX5D9SXCTrnzkNBNaw== 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=PBW4Fzdl; 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 89458606A685; Mon, 30 Nov 2026 15:12:46 +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=PBW4Fzdl Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6C271F000C1; Mon, 30 Nov 2026 15:12:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796051565; bh=JRYUi31wR+P/vOfP920/RFQ+pGiXW1it1lYMWtw5yO8=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=PBW4FzdlPASyHgrm8y5sNpuMFYFtM6AOVY1Mm3GgstC+YVceJ31eNu37f7Ko8ODqV rjby5CWm6qq2cjonHmjKuCn71SKIuJICwZV0uRCk2YhZyf0smXTf0T4eaEadke7/EF v2EU8EZlALtlj9GQryBbVojcJAPwcaG1tPxuMn7Kam10rn2vzHNtsImY01AG4O80G9 VjedGfB8ilpAHOKXEiSXd3rwysol704XkQEslcW5zIKU4sgbLZSzKQPyYt3jo0G+zE amqufeqqXZnU0B0egTDrkEbiYzZt345E3zDfpMPXjtnEa7q72El2qdYmsvoEd15dkb ai0sCQ5p6Tozw== Subject: Re: [PATCH net-next v16 07/15] net: dsa: realtek: rtl8365mb: set and get VLAN 4k 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: Mon, 30 Nov 2026 15:12:44 +0000 Message-ID: <179605156446.3146.2067251065745661227@kernel.org> In-Reply-To: <388e3024-0731-4113-a25a-1e739d6a0c39@yahoo.com> References: <388e3024-0731-4113-a25a-1e739d6a0c39@yahoo.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-kernel@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_4k_set_ivl() (drivers/net/dsa/realtek/rtl8365mb_vlan.c), nothing guarantees the LUT… - [Low] The comment above rtl8365mb_d_want_ivl() (drivers/net/dsa/realtek/rtl8365mb_vlan.c) says "@port/@filtering… -- net: dsa: realtek: rtl8365mb: set and get VLAN 4k for family D This adds two-word CVLAN pack/unpack helpers for family D. It also makes IVL_EN follow a switch-wide policy: IVL while any user port is VLAN filtering, SVL otherwise. When a vlan_filtering change flips that policy, IVL_EN is rewritten on the entries tracked in the new vlan_4k_used bitmap, and the dynamically learned L2 entries are then flushed on all user ports. > diff --git a/drivers/net/dsa/realtek/rtl8365mb_vlan.c b/drivers/net/dsa/realtek/rtl8365mb_vlan.c > index 566c6bc1449af..e923c7f3bb0a1 100644 > --- a/drivers/net/dsa/realtek/rtl8365mb_vlan.c > +++ b/drivers/net/dsa/realtek/rtl8365mb_vlan.c [ ... ] > @@ -277,6 +325,131 @@ int rtl8365mb_c_vlan_4k_write(struct realtek_priv *priv, > data, ARRAY_SIZE(data)); > } > [ ... ] > +/* Family D has no EFID. Use IVL while at least one user port is VLAN > + * filtering and SVL otherwise. The family D L2 helpers added later in the > + * series use the matching key for static FDB/MDB entries. @port/@filtering > + * override the state of the port currently being changed, as DSA updates > + * dp->vlan_filtering only after the driver callback returns. The result is [Severity: Low] Does this describe the DSA ordering correctly for every call of .port_vlan_filtering? In dsa_port_vlan_filtering(), the restore path calls the driver a second time after dp->vlan_filtering already holds the new value: net/dsa/port.c:dsa_port_vlan_filtering() { ... } else { dp->vlan_filtering = vlan_filtering; err = dsa_user_manage_vlan_filtering(dp->user, vlan_filtering); if (err) goto restore; } ... 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 code still seems to work in that case. rtl8365mb_d_vlan_4k_refresh_ivl() reads the current state through rtl8365mb_d_want_ivl(ds, -1, false). That value comes from the already-updated dp->vlan_filtering, so it matches what the forward call left in hardware. This only works because the ordering is the reverse of what the comment says. Could the comment be corrected so that later changes do not rely on it? One example would be caching the IVL state in the driver. The later commit "net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D" repeats the same claim in the undo_refresh_ivl comment in rtl8365mb_port_vlan_filtering(): DSA updates dp->vlan_filtering only after this callback returns, so old_ivl is the state before the change. In the DSA restore call, old_ivl is the state left by the forward call. It is not the state from before the original change. > + * switch-wide: a VLAN-unaware bridge that shares the switch with a > + * VLAN-aware one also gets IVL (known limitation). > + */ [ ... ] > +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); > + > + return 0; [Severity: Low] Can a failed flush go unnoticed here? The commit message says: After a successful switch-wide IVL_EN change, flush the dynamically learned L2 entries on every user port, so that none learned with the previous SVL/IVL key remains ... Such entries must not occupy LUT slots or become visible again after a later toggle. rtl83xx_port_fast_age() returns void. When l2_flush fails, it only logs the error: drivers/net/dsa/realtek/rtl83xx.c:rtl83xx_port_fast_age() { ... ret = priv->ops->l2_flush(priv, port, 0); mutex_unlock(&priv->l2_lock); if (ret) dev_err(priv->dev, "failed to fast age on port %d: %d\n", port, ret); } rtl8365mb_l2_flush() can fail on a regmap write or on a busy-poll timeout. In that case rtl8365mb_d_vlan_4k_set_ivl() still returns 0, and rtl8365mb_port_vlan_filtering() reports success. The dynamic entries learned under the old key then stay in the LUT until hardware aging removes them. > + > +rollback: > + /* Best effort: restore the entries rewritten so far. 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)) > + continue; > + if (!vlan4k.member || vlan4k.ivl_en != want_ivl) > + continue; > + vlan4k.ivl_en = !want_ivl; > + fi->vlan_4k_write(priv, &vlan4k); > + } > + return ret; The rollback path has a similar gap. It returns IVL_EN to !want_ivl on the VIDs that were already rewritten, but it never flushes. Entries the chip learned under the temporary want_ivl key on those VLANs would stay in the LUT. Should this path also flush the user ports? And should a flush failure be returned to the caller rather than only logged? The outer undo_refresh_ivl path added in "net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D" calls set_ivl() again. That does not cover the internal rollback here or a failed flush. > +} [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/aebcc7f6-d5f8-4157-b63a-e2e707d9859b%40yahoo.com