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=1796385655; b=kH72xb+UpojrgCkj2ejzStObapp0gJ7HTud45k051O/LReS+cFV6PZER8kcSSslR7Bvo qF7XXknFTLBNZkj4JRVgx1nUsVWua7H5jThdunyMgiidMvXyBGyCGHA+5bALRXhi8lTum UQVow+0e5QJGrJoEuLZhhe4EmWR0bIQk4iVZo5DMLedXYWzYFsFJf52YgnHQiJcK+KEvq XtEuvO/bH2YfjyAsUe8U7rGTP00VSWyX3EtL8w7DJAF5/iXRdxg0GBITbx63eP7Nfj2aA DxNyEsBR2vz6zaqjxfWIgi3Fut2XJQvvtI7GWXS25i8Ak6xNe815tO1i5T6LKVfV9RQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385655; 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=fQ0Lz4sZJ8zImcvhvV9dQaxPo/j3sT/kyud37IHNcNM=; b=0+ZwUL2DcQE5sKfJNGqghxsHfa9YnUeHwmolx+gWqqlItmgpOYb3yZY+ql+U6jv7SJu3 U/JuOrmeNgXUe50O2oetOVx6bKaz2hMTYHe99/fAaYgLdRmOLeyPvsy37vtHOFiAzyFAl 1m3v1DCMpGjToqZshp8D1YoRTgrLKlYjOK6Qe+NVZvIsiA2GuJlMVYkS2QjNGbnDIlVTl 0wdlRh4lgmMvTmAWkVPF/w56uAmqI4LkjntD4s9sPMoo8UVABN/rePhkfl82VE/RWVVdY cTwvcWRIUl6B5cWGCLs4sg2bUfP8p9UBCoZSLoLw8DPjzcxIkIrsAqE1KBMR0k5SNMw== 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=NQqAyDSM; 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 9A51C606A32C; Fri, 4 Dec 2026 12:00:55 +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=NQqAyDSM Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D66C1F00935; Fri, 4 Dec 2026 12:00:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796385655; bh=fQ0Lz4sZJ8zImcvhvV9dQaxPo/j3sT/kyud37IHNcNM=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=NQqAyDSMGPT6cc+hoN2zmsaia/AImu1UFHcYYwvjiw4R4thPXQITLZfMLbLIeihOO G5r7Z7nJUv3FSnKBLj6G7F6PLzaQNz8uobbyrSaLboJ31DISx0B4cDw3lmnkOkBbg2 3X1JCqEpSKzIi4wuDN71q8Ne1zLrEiRmnS5FZd66KPGcCXUWhtOuOPe6PAzJCghCGv yfOe5vB+D3+SBsSnwyL+gsJneOlrfvMhoiym02CrzO1buibakxRMz7uuhmhBv9rnsb 2PzRhGk3ckxf0UoZSzoqXRQzkJiZF9mAC+dlKDina3Z8ms4PM5IZi/2D8i4c5dEJhE OcGcKIIKHuD1g== Subject: Re: [PATCH net-next v2 5/7] net: dsa: microchip: ksz9477: do not learn addresses on the CPU port From: netdev-bot+sashiko@kernel.org To: o.rempel@pengutronix.de Cc: woojung.huh@microchip.com, UNGLinuxDriver@microchip.com, andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, daniel@makrotopia.org, horms@kernel.org, f.fainelli@gmail.com, razor@blackwall.org, idosch@nvidia.com, netdev@vger.kernel.org, bridge@lists.linux.dev, kernel@pengutronix.de Date: Fri, 04 Dec 2026 12:00:54 +0000 Message-ID: <179638565405.3146.5813472222670938710@kernel.org> In-Reply-To: <20261201-ksz-stp-link-local-v2-5-5dd1201d67c6@pengutronix.de> References: <20261201-ksz-stp-link-local-v2-5-5dd1201d67c6@pengutronix.de> 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 4 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 3 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] This patch adds a new refusal path to ksz9477_hsr_join() (drivers/net/dsa/microchip/ksz9477.c:1959-1965). - [Low] Concern: the KSZ8 family still turns on learning on the CPU port (drivers/net/dsa/microchip/ksz8.c:2581 and :2881). - [Low] Concern: on KSZ9477 the patch makes HSR offload and bridge offload mutually exclusive. - [Low] Concern: the new guards in ksz_port_bridge_join() and ksz9477_hsr_join() miss two cases. -- net: dsa: microchip: ksz9477: do not learn addresses on the CPU port This patch turns off learning on the CPU port of the KSZ9477 family and LAN937x, and sets ds->assisted_learning_on_cpu_port instead. While HSR is offloaded on a KSZ9477, the CPU port learns again. HSR offload and bridge offload are now mutually exclusive in ksz9477_hsr_join() and ksz_port_bridge_join(). > diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c > index 98211d9835734..2b563e4494541 100644 > --- a/drivers/net/dsa/microchip/ksz9477.c > +++ b/drivers/net/dsa/microchip/ksz9477.c [ ... ] > @@ -1937,6 +1953,17 @@ static int ksz9477_hsr_join(struct dsa_switch *ds, int port, > return -EOPNOTSUPP; > } > > + /* The CPU port learns while HSR is offloaded, so it would also learn > + * the senders of frames that an offloaded bridge forwards in software. > + */ > + dsa_switch_for_each_user_port(hsr_dp, ds) { > + if (dsa_port_bridge_dev_get(hsr_dp)) { > + NL_SET_ERR_MSG_MOD(extack, > + "HSR offload not supported while a bridge is offloaded - using software HSR"); > + return -EOPNOTSUPP; > + } > + } [Severity: Medium] Does the "using software HSR" fallback work if these ports offloaded HSR before? When ksz9477_hsr_join() succeeds, it sets the offload feature bits on the user netdev: user->features |= KSZ9477_SUPPORTED_HSR_FEATURES; ksz9477_hsr_leave() never clears NETIF_F_HW_HSR_DUP or NETIF_F_HW_HSR_FWD. Consider this sequence: 1. hsr0 is created on lan1/lan2 and offloaded. 2. hsr0 is deleted. The port map, the membership and PORT_SRC_ADDR_FILTER are cleared, but the feature bits stay set. 3. lan3/lan4 join an offloaded bridge. ksz_port_bridge_join() accepts this because dev->hsr_ports is 0. 4. hsr0 is created on lan1/lan2 again. In step 4, hsr_dev_finalize() checks the slave features before the driver join is called: net/hsr/hsr_device.c:hsr_dev_finalize() { ... if ((slave[0]->features & NETIF_F_HW_HSR_FWD) && (slave[1]->features & NETIF_F_HW_HSR_FWD)) hsr->fwd_offloaded = true; ... } Then ksz9477_hsr_join() returns -EOPNOTSUPP from the new check above, and dsa_port_hsr_join() resets dp->hsr_dev to NULL. Would ring forwarding then stop at this node? The hardware no longer forwards between lan1 and lan2. hsr_drop_frame() still skips software forwarding between the slaves, because NETIF_F_HW_HSR_FWD is set. hsr_forward_do() also sends on only one slave, because NETIF_F_HW_HSR_DUP is set. For that slave, dsa_xmit_port_mask() runs with dp->hsr_dev == NULL: net/dsa/tag.h:dsa_xmit_port_mask() { ... struct net_device *hsr_dev = dp->hsr_dev; struct dsa_port *other_dp; dsa_hsr_foreach_port(other_dp, dp->ds, hsr_dev) mask |= BIT(other_dp->index); ... } Can this loop match every port whose hsr_dev is NULL, including the bridged lan3/lan4? If so, HSR frames from this node would leak into the bridge's L2 domain. The notes below the commit message say the stale feature flags are an older issue in ksz9477_hsr_leave(). This patch adds a new and common trigger, though: any offloaded bridge on the switch. The new HSR/bridge exclusion also relies on the software fallback working. Could ksz9477_hsr_leave() clear KSZ9477_SUPPORTED_HSR_FEATURES as part of this change? > + > /* Self MAC address filtering, to avoid frames traversing > * the HSR ring more than once. > */ [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201-ksz-stp-link-local-v2-0-5dd1201d67c6%40pengutronix.de