From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A6689606A322 for ; Sat, 5 Dec 2026 13:23:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=TeidSwtA; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Pobbwaw+ DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Transfer-Encoding:Content-Type:References:In-Reply-To:Message-ID:Date :Cc:To:From:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=RzuNsOiJkKDlfVHv5kL8m/MMHF91RmQ51dT9TzZiUlI=; b=TeidSwtAYh8a5YujY1WfonNMeJ IoFw7lYa/sOB9secZEJcg39m0oucv+DVnsjeQwb0uJxgQVN1Q1dPf28evmYcwN6lr2jw8Iz3ZAOgB LcVnsICLWKCWv295xseWkWjksqTf2dZqY9KgkwPeRkyXOuWuF4U2Rcmg1NPUSB9JUapBxRiXo8gRW McanZe76JfQ8jk/G8wZLsOUGzCqusXsW2sXLFMoOB2qyIZT9iCvwqkkzm3ciokv55T49MOw2pyGLS LH2ZyaHil5Ck76zWo/T40f36GcT2yC4Yq2Zlev+owskCjbF0pA+Y5pfdLeilmOWM6c1f9L/Xc60qb i0HJxyMw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZpjR-00000002TK5-1OCS; Sat, 05 Dec 2026 13:23:17 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZpjP-00000002TJt-1to2 for linux-arm-kernel@lists.infradead.org; Sat, 05 Dec 2026 13:23:15 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id DE98040741; Sat, 5 Dec 2026 13:23:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 352CA1F0092B; Sat, 5 Dec 2026 13:23:14 +0000 (UTC) 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== Subject: Re: [PATCH net-next] net: sparx5/lan969x: ignore attributes of other bridges From: netdev-bot+sashiko@kernel.org To: daniel.machon@microchip.com 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 Date: Sat, 05 Dec 2026 13:23:13 +0000 Message-ID: <179647699367.3146.13735320739386424098@kernel.org> In-Reply-To: <20261204-sparx5-vlan-filtering-other-bridges-v1-1-b72e9562019f@microchip.com> References: <20261204-sparx5-vlan-filtering-other-bridges-v1-1-b72e9562019f@microchip.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Archived-By: MIME-Version: 1.0 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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