Article View: linux.kernel.netdev
Article #17410Re: [PATCH net v5 6/8] net: dsa: b53: reference count shared mirror source bits
From: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 19:02
Date: Mon, 16 Nov 2026 19:02
131 lines
12623 bytes
12623 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 1 · Low: 0
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).
- [High] This patch changes bcm_sf2_sw_resume()
(drivers/net/dsa/bcm_sf2.c).
- [Medium] The new error path in bcm_sf2_sw_resume() gates the switch
clock (`if (ret && !priv->wol_ports_mask)…
--
net: dsa: b53: reference count shared mirror source bits
This commit adds reference counts for each port's ingress and egress
mirror source bits in b53. A bit is only cleared when its last tc
matchall filter is removed. It also adds a b53_mirror_init() helper and
changes bcm_sf2_sw_resume() to return the result of ds->ops->setup().
[ ... ]
> diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
> index 1747a1f20c78e..98a4a62ca73a2 100644
> --- a/drivers/net/dsa/bcm_sf2.c
> +++ b/drivers/net/dsa/bcm_sf2.c
> @@ -996,9 +996,11 @@ static int bcm_sf2_sw_resume(struct dsa_switch *ds)
> if (priv->hw_params.num_gphy == 1)
> bcm_sf2_gphy_enable_set(ds, true);
>
> - ds->ops->setup(ds);
> + ret = ds->ops->setup(ds);
> + if (ret && !priv->wol_ports_mask)
> + clk_disable_unprepare(priv->clk);
>
> - return 0;
> + return ret;
> }
[Severity: High]
Does this make every other system resume fail, starting with the first?
bcm_sf2_sw_setup() is not safe to run twice. It ends with:
return b53_setup_devlink_resources(ds);
Probe already registers the "VLAN" devlink resource through
dsa_switch_setup() -> ops->setup. Only bcm_sf2_sw_teardown() removes it.
On resume the call chain is:
bcm_sf2_sw_resume()
bcm_sf2_sw_setup()
b53_setup_devlink_resources()
dsa_devlink_resource_register()
__devl_resource_register()
if (resource)
return -EEXIST;
b53_setup_devlink_resources() then jumps to out:, calls
dsa_devlink_resources_unregister(ds) and returns -EEXIST. Before this
patch that error was ignored. Now bcm_sf2_sw_resume() returns it and
also gates the switch clock.
dsa_switch_resume() then returns early:
if (ds->ops->resume)
ret = ds->ops->resume(ds);
if (ret)
return ret;
As a result, dsa_user_resume() never runs for any user port. Without
netif_device_attach() or phylink_start(), all user ports stay down
after an ordinary suspend/resume.
The failure path unregistered the resources, so the next resume
succeeds and the one after that fails again.
The clock is already off after a failed resume. The next
bcm_sf2_sw_suspend() (when wol_ports_mask is 0) and bcm_sf2_sw_remove()
will each call clk_disable_unprepare() again. Can that underflow the
enable/prepare counts?
The commit message only covers mirror refcounting and does not mention
this resume change. With the Fixes: tag, a stable backport would bring
this change along. Could this change be split into its own patch, after
making the setup path safe to run again on resume?
[Severity: Medium]
On this new error path, gating the clock is the only rollback. By this
point the switch is out of reset, the crossbar is configured and the
GPHY is powered on through bcm_sf2_gphy_enable_set(ds, true).
bcm_sf2_sw_setup() may also have enabled ports already. Nothing marks
the device as clock-gated, and the switch stays bound.
On the next system suspend, dsa_switch_suspend() still calls
bcm_sf2_sw_suspend():
bcm_sf2_intr_disable(priv);
...
bcm_sf2_port_disable(ds, port);
}
if (!priv->wol_ports_mask)
clk_disable_unprepare(priv->clk);
Won't this access switch registers while the clock is gated? It then
calls clk_disable_unprepare() a second time, which would trigger the
clk core already disabled/unprepared warnings.
Callbacks that run under RTNL, such as b53_mirror_del() when a tc
filter is deleted, can still run and would also access registers with
the clock off.
Before this patch, a setup failure on resume left the clock enabled.
The rst and cfp failure paths already roll back only partially in the
same way, but this path runs after the GPHY has been powered up. Given
the devlink -EEXIST issue above, it would be hit on every other resume.
It would also be hit on any register I/O failure inside setup, for
example in b53_enable_mcast_snooping(), or later in the series in
b53_mirror_init().
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112180202.324504-1-florian.fainelli%40broadcom.com
Technical Details
Message-ID:
<179485574117.3136.2818958695058742581@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer05.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364656-linux-kernel-netdev=dewy.ruReferences:
<20261112180202.324504-7-florian.fainelli@broadcom.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer05.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364656-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v5 6/8] net: dsa: b53: reference count shared mirror source bits Date: Mon, 16 Nov 2026 19:02:21 +0000 Organization: Usenet Network Message-ID: <179485574117.3136.2818958695058742581@kernel.org> References: <20261112180202.324504-7-florian.fainelli@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2144223"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:aGFLK2aHTvxOjpBKQL52IBXDr5Y= sha256:zzuEDoRQf7eemrEP+u8OQB6JKZjYIqp0CwC7H/Ipc7k= sha1:7nvEabAqXXRr8J0KrHPvCu55q44= sha256:ot6IUtvIowzLjG+vULRi2SIK7PZH2TUaZb3cWtEMm3g= 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 6A5EE114D42; Mon, 16 Nov 2026 22:02:58 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, 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] 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 gKzbID8SzkL9; Mon, 16 Nov 2026 22:02:53 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-364656-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 6BA41114D40; Mon, 16 Nov 2026 22:02:44 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 611D527592; Mon, 16 Nov 2026 19:02:38 +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=1794855748; b=2i7tPEq+DQzaRthXD3zouwFlt6FsmLT4w+GTPuOXZNQscL2DYUoQFU/F/EKJfLzOT6er +cBkP4frMhCz5ZaO0esk+Y4zAxRJogvYs3AGjIurv6wIJCSrDZKuBTMTcM+M8IKepUFle NYzIFn2zLqo0EaAxFkCFQsbPER8/yFfrv+437zq008vociYkWFUVbrKX4y/sLFagRErv2 +0Tmu/+3Ky8ywRWIDcSpML1e+RmslCdjUEWgu+fBulA0cuBrW3i+EKMHjKBRLvqkF6dyo GSyAYwK1x8zmS6nUhYU1yVohOQPfdixXwDOih7Pnar8LIZgw6cK2xyQKlfvSo4jR6OA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794855748; 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=N2xKCSrPY1rJ1XkR4LIjxTn9dqMbXrnTZ+YOM+EyOfM=; b=LHccA4L7a+OP0Hb0zqD+k0SlSFcrOTbGKl9VbaJzwFWZlzCeWj900OiKBGspDRDVCT/2 9mHPd4gs5XAOTBBc9LJGI3ef3euymnSAAg0rebBLycxgfv6zElWK9mmMimalPBiHmOfVo WBLOg8h69sVYJfk9ljpzuQAyxIxQvfBQ2WZyDdzcZ2i++Ed+4mYC7nzgq/hf+z7L6yJv2 sYxYWZ46hHsusnRm/htnqjKuW8LTgpWFdx0ONVKSPzEDO4G0QMXBNk36ymByZxhb70WsU y5upviXHKOmr30hNHpI0irZh5plIqdiuo+3yQxr4GryxcbHCmbEyhBI+0rFX7MMuTtw== 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=VprP7W2C; 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 43FD6606A8A7; Mon, 16 Nov 2026 19:02:28 +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=VprP7W2C 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=1794855742; b=sgJTbPZZ/r+I2xGMnsselwEHIGl/5fTAslr8iiSycbKCYWLXyR7hrrvu4wuheEEPfvt/ juHyEvH7tUyFxkBCXdz1U+iL48SO4E0n8fGGxHc6y+CWjr+fGfZWn7p2FActmPt/7Watb TC+6H3hdcOEEpzUtOOxofjNfLp2M+hU/z5uY2m+GOV0qWkdmuTTiWohuUiQAigYSiSk8Z pENiluMOQ/WjXKuuLuDu71A6wRbmMU1NFcB7o/YesiWBC+zn+AC0A7ABZmwG1FF5amYUW QZ5XhfLtT2f8D98XKtwvP8dz7Myzbv4ZpxZcz/qVoHQ6JAgJRVQDJZ4r8SXPTSFg/KA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794855742; 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=N2xKCSrPY1rJ1XkR4LIjxTn9dqMbXrnTZ+YOM+EyOfM=; b=Greg5tRnp2nx1ooufw9aoJr9IO1bILp4qcKCtIeAS6Eln7XYUqDQly1xsoUDsJdAnS6k N50yZ9eh4qNnOaot17msKe6v0/BauQ7JUt/p8mccsx/VVydntoBpEp3fPKvaPP7Svw8+Y NvH6hzMfU7w4jj2Jz43zji80W77S3o72maRt4aRdxbI3Eld6D9vLfzvSuqtlclsmgu2bC e0C8jp3OWxmehZ/SFMWsKN19sonvrS68xCODLSjyMcdK/SiLieURt3G4ZRpBCwPJQdOef 58Hq0MutsUNIx+JnfEVR56YMj93gqgTB8JvEpp4k24eqtddBLXKlwdAmRIUxoUbbhIQ== 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=VprP7W2C; 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 643C3606A332; Mon, 16 Nov 2026 19:02:22 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 992CF1F000CE; Mon, 16 Nov 2026 19:02:21 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794855742; bh=N2xKCSrPY1rJ1XkR4LIjxTn9dqMbXrnTZ+YOM+EyOfM=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=VprP7W2CiFZmaAi96m1oPMFzTZJmXLyzsL0fDPruE+CMRr2nqOdKIzRWGKeCz7Rlk 18d8WIrH32+fB/G9V/UAoZogshvev2UEfW6fCc4iwW4WnJigBcNcJ++2EIYcJ4Slim fifGbJZCCRLnM1oP0w39fixdN1Lh9j21bFMeVjslvLyr9nq4fawN23iapFhQHU+bCu utsiK7PXZzHp6zf8urlYrG2C120A4sRmV2yfgjSBxnnZcXXfnoBitwAbNkS5r7qB73 YtJkGP7pIz3jpXRLkd+1EX5zpeBGO5NVfccIBt619OuVkr6HcqO+VL92q0v1LOKBXK s2D4sCayLq6FA== X-Cc: netdev@vger.kernel.org, jonas.gorski@gmail.com, andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, vivien.didelot@gmail.com, linux-kernel@vger.kernel.org X-In-Reply-To: <20261112180202.324504-7-florian.fainelli@broadcom.com> X-sashiko-severity: High 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 X-Received-Bytes: 12337