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=1796476995; b=maiEdpOvdlUSLnyrisIfe6qKt599gHSQ0Ys5/s8gIXXdK1yP/JckemfyLwSkZ2mJuzZT cRmXOT6yXLk0yDXByjIZSQDu6NvNXHZDzQrnfQ+KsWPnG2KMP9nO9req53vNtR4/lG5ir 7p1sMB7f5SsLB32ymPD3wWkmNnQq8AgSevChnO840kJeCAWzB7oI8tJ+N3b1oRVATs62L pffshTHcX42qvBz/bWb3QQoJFBXYVTZbPPx90X9mSuM9agdyb5mGvxgZ4cMjjI0N1fXGP hhHuqiBVp1OZ67MKQZPejuHDDFmdspbC438L029hsY/6CRx/xUO9AKDjNmL10lThylg== 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== 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 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 ; Sat, 5 Dec 2026 13:23:14 +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=Pobbwaw+ 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-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 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