Article View: linux.kernel.netdev
Article #26917Re: [PATCH net-next v2 5/7] net: dsa: microchip: ksz9477: do not learn addresses on the CPU port
From: netdev-bot+sashiko
Date: Fri, 04 Dec 2026 12:00
Date: Fri, 04 Dec 2026 12:00
125 lines
12573 bytes
12573 bytes
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
Technical Details
Message-ID:
<179638565405.3146.5813472222670938710@kernel.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377318-linux-kernel-netdev=dewy.ruReferences:
<20261201-ksz-stp-link-local-v2-5-5dd1201d67c6@pengutronix.de>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377318-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v2 5/7] net: dsa: microchip: ksz9477: do not learn addresses on the CPU port Date: Fri, 04 Dec 2026 12:00:54 +0000 Organization: Usenet Network Message-ID: <179638565405.3146.5813472222670938710@kernel.org> References: <20261201-ksz-stp-link-local-v2-5-5dd1201d67c6@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2756999"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:1Ml5sUc8vvjokBhcgnvo9gYDFGA= sha256:yFLcsfIAiHfvwEGLr5ceUbs2myu+rH6BUuBvG1gMgZg= sha1:X/swaw37oQlKtD9AC3D3GwX8Jm8= sha256:cwDtnRXCx7Gu/HbQLxmeQ8kPEtZPMn7KOq7pCuWnBkQ= 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 B60B6117BD9; Fri, 4 Dec 2026 15:01:19 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.541 X-Spam-Status: No, score=-3.541 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.142, 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 WfV-0nAfnJow; Fri, 4 Dec 2026 15:01:15 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377318-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 6FAD1117BD8; Fri, 4 Dec 2026 15:01:01 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 1CC5A37DAB; Fri, 4 Dec 2026 12:00:57 +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=1796385656; b=qcnoVPhSjoA5sxPlKooDKcIoPZ8ObOoySylIb3v8CgSG/ncANWdF0XM3XtPJcVMvu6aZ lfBGUARFaS0PBqkIcGYZ9x/lzkUG58cvDJAtyKR8paszt4T9n3l5EYKhoI1bKxyW+hdUH X7+kPyO8JzKSI9zS7FtsiAOR1P3/szsewH9S6wCRzkxJ5afvyveplzQ8fnkgBtm7RzTOm arbJg/8CACxmDJpIcvpjI57KAPFcw1e/wp7wQyVqfsjP7JE17C7G+zWQr0FvL3Hs7Gzmc 6VOMrTSZUNUx2smMhh/8RKdA4o05jI8cP0jLOhpNl4Ezya/b71nzWk98+BHHpkvOh3A== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385656; 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=fQ0Lz4sZJ8zImcvhvV9dQaxPo/j3sT/kyud37IHNcNM=; b=UJJ50WkKwZJ9S6/fsPOUylbioZqgNTRwNJilQ1xkxQDuFQAFgGXw68DsrvYU/wJEGf5j puz5PLG7Gx7t+Ie/3Zj9tWet8uHevqbDqDwCvHrhdgc/RhT3GRNGlnuvpfLTM6F7GFSZs kGE0EXZKLrIsQ5L6sXCvlez836QKUXKcAGmJk91CnOopD5tMUER5t7uSJyKK4xHH2kmDJ uWJ2jN8KOpf7zo8p1gZ3GKdLt+jPQrQGLz3twTWwTcOWZN9AdKPU7t3NiNeTIJAjklLAJ bs3LfOxo6elbiAHJrNa/+g40Z1rsQRNjr+Wzeb354sIwO3fsxQFT/DfJL2b2oo6MCfw== 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=NQqAyDSM; 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 7C9C8606A339; Fri, 4 Dec 2026 12:00:56 +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=NQqAyDSM 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=1796385655; b=kH72xb+UpojrgCkj2ejzStObapp0gJ7HTud45k051O/LReS+cFV6PZER8kcSSslR7Bvo qF7XXknFTLBNZkj4JRVgx1nUsVWua7H5jThdunyMgiidMvXyBGyCGHA+5bALRXhi8lTum UQVow+0e5QJGrJoEuLZhhe4EmWR0bIQk4iVZo5DMLedXYWzYFsFJf52YgnHQiJcK+KEvq XtEuvO/bH2YfjyAsUe8U7rGTP00VSWyX3EtL8w7DJAF5/iXRdxg0GBITbx63eP7Nfj2aA DxNyEsBR2vz6zaqjxfWIgi3Fut2XJQvvtI7GWXS25i8Ak6xNe815tO1i5T6LKVfV9RQ== X-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== 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=NQqAyDSM; 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 9A51C606A32C; Fri, 4 Dec 2026 12:00:55 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D66C1F00935; Fri, 4 Dec 2026 12:00:54 +0000 (UTC) X-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== X-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 X-In-Reply-To: <20261201-ksz-stp-link-local-v2-5-5dd1201d67c6@pengutronix.de> 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