Article View: linux.kernel.netdev
Article #27390Re: [PATCH net-next] net: sparx5/lan969x: ignore attributes of other bridges
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 13:23
Date: Sat, 05 Dec 2026 13:23
173 lines
14800 bytes
14800 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 2
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] net: sparx5: BRIDGE_AGEING_TIME check drops br_init_port()
port orig_dev
- [Low] The patch fixes a real, user-visible bug that dates back to
commit d6fce5141929 ("net: sparx5: add switching support"), but it has…
- [Low] The new SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME filter in
sparx5_port_attr_set() only checks `attr->orig_dev !=…
--
net: sparx5/lan969x: ignore attributes of other bridges
With this patch, sparx5_port_attr_set() applies port attributes only when
attr->orig_dev is the port itself. It applies bridge attributes only when
they come from the offloaded bridge. Attributes from other bridges, which
arrive through a VLAN upper or a bond that is not offloaded, now return
-EOPNOTSUPP.
> diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c b/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c
> index 322806fbfe2bb..9e85a746414c4 100644
> --- a/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c
> +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c
> @@ -140,18 +140,39 @@ static int sparx5_port_attr_set(struct net_device *dev, const void *ctx,
[ ... ]
> case SWITCHDEV_ATTR_ID_PORT_STP_STATE:
> + /* Ignore it from a bridge port other than the port itself */
> + if (attr->orig_dev != dev)
> + return -EOPNOTSUPP;
> +
> sparx5_attr_stp_state_set(port, attr->u.stp_state);
> break;
[Severity: Low]
Should this have a Fixes: tag?
The commit message describes a user-visible bug. Removing a VLAN upper
such as eth0.100 from a foreign bridge runs br_stp_disable_port(). That
sends PORT_STP_STATE=DISABLED with orig_dev set to eth0.100.
__switchdev_handle_port_attr_set() then recurses into the lower eth0, and
sparx5_attr_stp_state_set() clears eth0's bits in bridge_fwd_mask and
bridge_lrn_mask. eth0 then stops forwarding in the offloaded bridge.
The unchecked STP state, bridge flags, ageing time and vlan_filtering
cases look unchanged since commit d6fce5141929 ("net: sparx5: add
switching support"). PORT_PRE_BRIDGE_FLAGS and PORT_MROUTER were added
later and have the same gap.
The note below the --- line says:
This does not fix a regression, so it is targeted at net-next.
Documentation/process/submitting-patches.rst asks for a Fixes: tag
whenever a patch fixes a bug in a specific commit, not only for
regressions. Without the tag, backport tooling will not pick up the fix.
> case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME:
> + /* Ignore it from a bridge the switch does not offload */
> + if (attr->orig_dev != port->sparx5->hw_bridge_dev)
> + return -EOPNOTSUPP;
> +
> sparx5_port_attr_ageing_set(port, attr->u.ageing_time);
> break;
[Severity: Medium]
Does this also drop the ageing time that the bridge sends when a port
joins or comes up?
br_init_port() calls __set_ageing_time() with the bridge port, not the
bridge:
net/bridge/br_stp_if.c:br_init_port() {
...
err = __set_ageing_time(p->dev, p->br->ageing_time);
...
}
__set_ageing_time() stores that device in attr.orig_dev. br_init_port()
runs from new_nbp() in br_add_if() and from br_stp_enable_port(). For a
sparx5 port, the attribute therefore arrives with orig_dev == dev, and
that never equals hw_bridge_dev. The new check returns -EOPNOTSUPP, and
SWITCHDEV_F_SKIP_EOPNOTSUPP hides the failure.
Only br_set_ageing_time() and __br_set_topology_change() send the
attribute with br->dev as orig_dev. sparx5_port_bridge_join() does not
apply br_get_ageing_time() itself, and sparx5_port_bridge_leave() does
not restore the default. After this patch, nothing programs the
hardware ageing when a port joins.
Two examples. First, create a bridge with ageing_time 30s and then add
the sparx5 ports. The ageing_time change happened before any sparx5 port
was a member, so the switch keeps the probe-time value from
sparx5_mact_init(). Second, delete a bridge that used a short ageing
time and create a new one. The hardware keeps the old value. In both
cases the hardware FDB ages differently from the software bridge until
userspace sets ageing_time again.
Would it work to also accept orig_dev == dev here, as long as the port
is set in bridge_mask? That still ignores the br_init_port() event from
a VLAN upper, and the one from a join that sparx5_port_bridge_join()
rejected. Another option is for sparx5_port_bridge_join() to apply
br_get_ageing_time(bridge) on join, the way
dsa_port_switchdev_sync_attrs() does for DSA.
[Severity: Low]
Can hw_bridge_dev point at a bridge that is not offloaded when this check
runs?
sparx5_port_bridge_join() sets hw_bridge_dev on the first join. Its error
path does not reset it:
drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c:sparx5_port_bridge_join() {
...
first = bitmap_empty(sparx5->bridge_mask, SPX5_PORTS);
if (first)
/* First bridged port */
sparx5->hw_bridge_dev = bridge;
...
err = switchdev_bridge_port_offload(ndev, ndev, NULL, NULL, NULL,
false, extack);
if (err)
goto err_switchdev_offload;
...
err_switchdev_offload:
clear_bit(port->portno, sparx5->bridge_mask);
return err;
}
Suppose switchdev_bridge_port_offload() fails on that first join, for
example with -EBUSY from nbp_switchdev_hwdom_set(). Then bridge_mask is
empty, but hw_bridge_dev still names that bridge.
Next, a sparx5 VLAN upper or a bond with sparx5 members joins the same
bridge as a software port, and ageing_time is changed:
br_set_ageing_time()
__set_ageing_time(br->dev, t)
__switchdev_handle_port_attr_set()
sparx5_port_attr_set()
sparx5_port_attr_ageing_set()
orig_dev == hw_bridge_dev, so the new check passes. The global hardware
ageing is then set from a bridge that the switch does not offload.
The VLAN_FILTERING case below avoids this because it also tests
bridge_mask. Would it make sense to add a bridge_mask check here too?
Another option is to reset hw_bridge_dev to NULL in the join error path
when first is true.
> case SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING:
> + /* Ignore it from a bridge the port is not offloaded in */
> + if (!test_bit(port->portno, port->sparx5->bridge_mask) ||
> + attr->orig_dev != port->sparx5->hw_bridge_dev)
> + return -EOPNOTSUPP;
> +
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204-sparx5-vlan-filtering-other-bridges-v1-1-b72e9562019f%40microchip.com
Technical Details
Message-ID:
<179647699367.3146.13735320739386424098@kernel.org>Path:
mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377999-linux-kernel-netdev=dewy.ruReferences:
<20261204-sparx5-vlan-filtering-other-bridges-v1-1-b72e9562019f@microchip.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377999-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next] net: sparx5/lan969x: ignore attributes of other bridges Date: Sat, 05 Dec 2026 13:23:13 +0000 Organization: Usenet Network Message-ID: <179647699367.3146.13735320739386424098@kernel.org> References: <20261204-sparx5-vlan-filtering-other-bridges-v1-1-b72e9562019f@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3035318"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:2x39i7y27b0mPDa5LDU3uonLKoY= sha256:wxNoYTV3IwpSp87WwlsUSz+kcZjJMefmiww/LZACZ6U= sha1:v2WcglikZcIdesX1yMZc4f0qscM= sha256:+lknh6U9s4Lgl1mqnvEW9f+GiEa/NAwltMBEs+LHgbA= 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 9B35C117E2A; Sat, 5 Dec 2026 16:23:39 +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 KAXMUWuZm3Qe; Sat, 5 Dec 2026 16:23:35 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-377999-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 6623B117E1D; Sat, 5 Dec 2026 16:23:23 +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 78206281AF; Sat, 5 Dec 2026 13:23:19 +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=1796476996; b=vmvXWauV9F1+T3r9W+OLi+fLxyT7EOlHaL5wMpwbrhxRLJ9qIIp5/nQC6YM9WaA4wj5O lke0Qs3R5iiwe4I8UHnao9Y/xm/skFpbhPelxKt2op8Wi+fX+UnmodOuWZF9G+QgOuy5e RMnhF1ZZNaaMW6vR2H2hWms5CMt9BPPOOnYGF4xySiEzKsY1o0or8KbhJ2aw4d3JT8V1h 3uxqj373bDiFq21e+/bEkCqiOMyr+xEQD8xpno/oyz0TR+t6xkcPOIrR7v6fJYrwfJBTF mn+UW8wIQT6gJ2/NYipMez5S1dNfFLPxqwFVz+Z6aZ9wM/e48311ZtwnY40GQjbf+TQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796476996; 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=RzuNsOiJkKDlfVHv5kL8m/MMHF91RmQ51dT9TzZiUlI=; b=BjbOSPkXNYiZyWuIcLErsPuAxJmgZoCLRjp+yDQw2Ly3MCCjPiAko2WigFtOBP6J33at +/ovWmeVUnrCDb2GuAF/X75EIWed6msvby6CRvCv9EMMAGnytrSny7rQ87cn1v3nO/Uuy eQhZ08UWeFZCqJtqzDBxjcmGiwNR1BJdaW2lQCgioSC/sC3QuB7GwWel9GETcpW7NZ335 clwvTNAieb74WyYTs/v3PeFWuiKzIkH9MJra2b4y7c3txCYfU3NT3GjnLPGDG9GXataV2 pDp68unAdNkc04i046Y+enxEMeP4x2saN/0DKHYrtsr5OGP2qDsHTLJt+raC5CMarGg== 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=Pobbwaw+; 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 26144606A335; Sat, 5 Dec 2026 13:23:16 +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=Pobbwaw+ 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=1796476995; b=maiEdpOvdlUSLnyrisIfe6qKt599gHSQ0Ys5/s8gIXXdK1yP/JckemfyLwSkZ2mJuzZT cRmXOT6yXLk0yDXByjIZSQDu6NvNXHZDzQrnfQ+KsWPnG2KMP9nO9req53vNtR4/lG5ir 7p1sMB7f5SsLB32ymPD3wWkmNnQq8AgSevChnO840kJeCAWzB7oI8tJ+N3b1oRVATs62L pffshTHcX42qvBz/bWb3QQoJFBXYVTZbPPx90X9mSuM9agdyb5mGvxgZ4cMjjI0N1fXGP hhHuqiBVp1OZ67MKQZPejuHDDFmdspbC438L029hsY/6CRx/xUO9AKDjNmL10lThylg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796476995; 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=RzuNsOiJkKDlfVHv5kL8m/MMHF91RmQ51dT9TzZiUlI=; b=oPohtAuNK8wtIKptm+fa0ywz99Az7bFq6rxcrMQ5RLCqwo1toGnyfLxVg0/j52lIpALH 6dZcyXdhri9/I9lmbRc+hW1HbIX7qtSPWEu9H40HoAwiZHxXN/4Z3PbOnJhLOIzxexuTB t+xwrL2Yx9Hs0vEurbPR/svlvup60W6mcdWn7WjOzKFa3A8zVp8P5cd/WHiiWyAuSVIRO njAIPFFd4R280FVRZqaajnuTjZox6yoek9bgqlVidR+O8GWqiRYaa/Ynz8sK2kdf6ahES UX99ayXDfX/PhT4x3wS2W85uxwWL6WxAPjAO4hs4mKw2zS411oOoNfxbq0hnjOTFR5Q== 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=Pobbwaw+; 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 41A09606A322 for <netdev@vger.kernel.org>; Sat, 5 Dec 2026 13:23:14 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 352CA1F0092B; Sat, 5 Dec 2026 13:23:14 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796476994; bh=RzuNsOiJkKDlfVHv5kL8m/MMHF91RmQ51dT9TzZiUlI=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Pobbwaw+ZonW15XrS3qMqVFGqW4cNnYobby5XNRQd6/kMAxG3tJMhBtjrgWGIY8Ak HmECdFW+hkFOItPht87kLg0ghgQZh7Zv/8h3V011i5p//WR2ey9hs4tHA/237ANsiN +8IknMnYAxdpdC8EbjagLJrISGdPJsWbGspw4Ol8AdaEgugx2LliLNfheB7FY2v6MX yLd8kRHXjZvzU0Pr/NBsZ0rMyV6qCtJmjeEaOQc0f2XivaBDRFozF8x1+Bh5Ef2y+D dcsdu9thbZ5CgAxpc6D3GvFQxu0gQbndM7YG6uwVVsBWxffDPDGlxjyvfQYBv1ZRqg V9h0CE3DiNicg== X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, Steen.Hegelund@microchip.com, UNGLinuxDriver@microchip.com, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-In-Reply-To: <20261204-sparx5-vlan-filtering-other-bridges-v1-1-b72e9562019f@microchip.com> X-sashiko-severity: Medium 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