๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23407

Re: [PATCH net-next 3/5] net: dsa: microchip: ksz9477: do not learn addresses on the CPU port

#23407
From: netdev-bot+sashiko
Date: Fri, 27 Nov 2026 08:24
126 lines
12684 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 0

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 causes an HSR offload regression on KSZ9477.

--

net: dsa: microchip: ksz9477: do not learn addresses on the CPU port

This patch turns off address learning on the CPU port of the KSZ9477
family and LAN937x. It sets ds->assisted_learning_on_cpu_port instead, so
DSA installs the addresses the bridge learns outside the switch as static
entries on the CPU port. This prepares for software forwarding of trapped
link-local frames.

> diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
> index 98211d9835734..8271bc742ddc5 100644
> --- a/drivers/net/dsa/microchip/ksz9477.c
> +++ b/drivers/net/dsa/microchip/ksz9477.c

[ ... ]

> @@ -1792,13 +1791,15 @@ static int ksz9477_setup(struct dsa_switch *ds)
>  	if (ret < 0)
>  		return ret;
>  
> -	/* Start with learning disabled on standalone user ports, and enabled
> -	 * on the CPU port. In lack of other finer mechanisms, learning on the
> -	 * CPU port will avoid flooding bridge local addresses on the network
> -	 * in some cases.
> +	/* Ask DSA to add the addresses that the bridge learns on ports
> +	 * outside the switch as static entries on the CPU port. The CPU
> +	 * port itself does not learn: when the bridge forwards a frame in
> +	 * software between two ports of the switch, the switch would learn
> +	 * the sender on the CPU port. p->learning is never set for the CPU
> +	 * port, so ksz_port_stp_state_set() disables learning when DSA sets
> +	 * the port to forwarding.
>  	 */
> -	p = &dev->ports[dev->cpu_port];
> -	p->learning = true;
> +	ds->assisted_learning_on_cpu_port = true;

[Severity: Medium]
Does this cause a regression for HSR offload on KSZ9477? Unicast frames
addressed to the local HSR node now seem to be forwarded to the other ring
port as well.

Before this change, the CPU port learned the HSR MAC from frames the host
sent. That learned entry sent unicast with DA == HSR MAC to the CPU only.
Now dsa_port_enable_rt() moves the CPU port to BR_STATE_FORWARDING, and
p->learning is false, so ksz_port_stp_state_set() disables learning there:

ksz_port_stp_state_set() {
    ...
	case BR_STATE_FORWARDING:
		data |= (PORT_TX_ENABLE | PORT_RX_ENABLE);
		if (!p->learning)
			data |= PORT_LEARN_DISABLE;
    ...
}

The replacement doesn't seem to cover HSR, because HSR ports are not in a
bridge:

dsa_user_fdb_event() {
    ...
	if (!dp->bridge)
		return 0;
    ...
}

dsa_switch_supports_uc_filtering() needs ds->fdb_isolation, which the
microchip drivers don't set, so standalone host address filtering doesn't
add the entry either.

ksz9477_hsr_join() doesn't install a static ALU entry for the HSR MAC.
ksz_switch_macaddr_get() only programs the self-address filter register.
ksz9477_hsr_join() also makes the two ring ports and the CPU members of
each other's forwarding set:

ksz9477_hsr_join() {
    ...
		hsr_ports |= BIT(dsa_upstream_port(ds, port));
		dsa_hsr_foreach_port(hsr_dp, ds, hsr)
			ksz9477_cfg_port_member(dev, hsr_dp->index, hsr_ports);
    ...
		data |= HSR_DUPLICATE_DISCARD;
		data &= ~HSR_NODE_UNICAST;
    ...
}

ksz9477 never programs unknown unicast control (REG_SW_LUE_UNK_UCAST_CTRL__4
is unused). Unicast to this node would then miss in the ALU and flood to
the other ring port and the CPU. It would keep going around the ring until
the sender's self-address filter drops it.

The hardware meaning of HSR_NODE_UNICAST is not documented in the tree.
If clearing that bit made the switch deliver node-addressed unicast only
to the host, this flooding would not happen. The note below the --- line
reaches the same conclusion, that the frames are flooded.

That note is dropped when the patch is applied. The commit message doesn't
mention this behavior change, and nothing in the series changes the HSR
join/leave path.

Could ksz9477_hsr_join() add a static ALU entry for hsr->dev_addr on the
CPU port, with ksz9477_hsr_leave() removing it? Another option is to keep
CPU port learning enabled while dev->hsr_ports is non-zero.

>  
>  	if (dev->irq > 0) {
>  		ret = ksz_girq_setup(dev);

[ ... ]

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126-ksz-stp-link-local-v1-0-39aed15f6271%40pengutronix.de
Technical Details
Message-ID: <179576787449.3135.11974599854572162575@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372536-linux-kernel-netdev=dewy.ru
References: <20261126-ksz-stp-link-local-v1-3-39aed15f6271@pengutronix.de>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372536-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 3/5] net: dsa: microchip: ksz9477: do not learn addresses on the CPU port
Date: Fri, 27 Nov 2026 08:24:34 +0000
Organization: Usenet Network
Message-ID: <179576787449.3135.11974599854572162575@kernel.org>
References: <20261126-ksz-stp-link-local-v1-3-39aed15f6271@pengutronix.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="682462"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:j3Zgd5Z7jbbBfbzoY65XZFBuYeM= sha256:9Jpdi3HBU7i7VGf2+0+QDL+8Bv2lvkP9zxKXNaMW7Io= sha1:VvL7NoXjF9ejpUKR/Te3OWLfcUE= sha256:IJyy2m25+ZgZuazviuBpMGkCcIb9WfCUyLUCxLhQzAI=
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 7D364125F20; Fri, 27 Nov 2026 11:25:01 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, 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] 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 FX5ZWTZ_DFLS; Fri, 27 Nov 2026 11:24:57 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-372536-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 1FFE4125F25; Fri, 27 Nov 2026 11:24:45 +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 4CFBC23E5D; Fri, 27 Nov 2026 08:24:42 +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=1795767877; b=POfOKBALGCvrbBe+FLuCZ3tBxzf3V8C4foEwFGBX35khi5gqzeqVgC60yli94zgKkr2W 36m82uQWKrTl3gqUMtclTWeDiFtdK3cVhl5bvwWtL1eaoBO1CXXbmNfwwde2K/7UDuwaw 88PQQDj05RTb23C22Xs35W2HoXoKmzRoEWtYMJM66g8ToonI0ShxRMq+CkWg/vjLGsLVU M3CMXfbzYQs1VrohSnX1tDD4Cn/q+WCJnogrFEx8y8UrniCcofuKct7diIIeaFNDhEF3m W35MkKsCGuUY1AAQhGPkbo/wIyb9ciNAoaGAyAmZfAr2e3672cClcsxrwioFWUMhmEg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795767877; 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=MlOHk0M8kwtp5u/zTni7+wcFytDELTmVJD3AV1zqGes=; b=HbqYo3y3sL9c51hM4wXdAM518G1dRSK/wuQychNfzg92yNVZdMFZCVgTspgUQ+WoZ+vY 3MsipcYOotrgWOdkrVdB0nqnOfYCvWtyxCuNfBgH4kva7cUenuVOmCwLWjEYmeGnK71oo VnWVZbmWv0Gu76FfOshjSq9CtTF6JrhtmD3c95+TJJ4hsMb7zuz0y99FF6oRcZvJFZpLM zcDaYlltIBeprN//pbl5vAOzYDJv/nAkchilcI2PZlV7RRTHerR6hHwjAOERjtiwL1Cwk 593Yr6PHMYGJtNny+EGlmnS3CuatI7zF1eMrwhD1Zl+MjUokDPzNLt1cD3w4ITOWt1A==
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=WbNoY0RT; 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 16978606A690; Fri, 27 Nov 2026 08:24:37 +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=WbNoY0RT
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=1795767876; b=oNiRHNhYsOuaGwPDAP1Gf8OGdJ+nNW42/K4mIHjCGq8vDihV1JsAZqH1IvAziQflWYIv Tp1b7+1nhAh5V0e3c78adt3DYCJZZBUxyDX9ankjMmqexlN5jrIHk9l2QDWPQDrouekJo 4O7TH1r19WUEzI1wFydVTSMZ4ljQ8Mk5BFLzZldKjLFPQZMSS7J0eaFoEJGgSaMWfapko +Wcl4wI90vVRGzjADiKFLLX5/Gq090faYlA2nzunzY+v2yHdHfbtI8OiywZRQMcK/w89d EVRBe9Te3NgJJLDDNZDy9zKueSPF3OiRthPC/pOi18Jpy2mST9lAWZISiNVQW0XHTXQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795767876; 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=MlOHk0M8kwtp5u/zTni7+wcFytDELTmVJD3AV1zqGes=; b=TP2bHfwphh+11pAv1TWh/dcRvs5/ljWduouM2ITpqiT+qhQUMD1r1dXAUliqkcQy2c6q DK3nRG5Btc3lfQkBvjSAiJ6oP4jSSKKd3YnXj1cOc5l0nuwQC7raX+sevdXzJdQnF6WdS 4blKWXSj8j3u4GBna5Q51xsqu50kP4l+RYT8mTmc4lwHSsPNFZP3zRlSQkHxKbYbClqNC f2EnZ18/htW5xw/llC2p+mE68xUg9EzkgY5zKuDO06Po/xy0pqv1kwt+nLM9Wo+N4cwYe TS3lkakFXT2vjZ6e6YOhcTc8kiPNPXCs2b7M7OYIbB7xI0qzJ1J29tnjrYu1AUJN9Sg==
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=WbNoY0RT; 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 39A59606A687; Fri, 27 Nov 2026 08:24:35 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD3E51F00893; Fri, 27 Nov 2026 08:24:34 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795767875; bh=MlOHk0M8kwtp5u/zTni7+wcFytDELTmVJD3AV1zqGes=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=WbNoY0RTpM3bhTHwvJlotlaOmwBq0Ssd1yvP+wWglFLXIB7JFu/NPTAtFh3bHvQP6 2napRyq10+ZHln6yr6iRxvGV7vo7hWbZH2I4O1KYUIMnp13Djqa3rscuBW10ON1dcQ ZQYtHBnTV/iCYpqPeR6WZ/GfeCn9BcW+vfn+1dew5F2ZV6+4yMKZBTHQPoV8TC6xOq 057CTkxgyorNOHyF1+4BY8/7WlOX98jFztCitdRpz5/ySKpln61wVtSq7fV24/a1wT AzHJnc3vmvISwhWOrGvvnU1U74t1rbiIA29ij+TNjtXUxvI0Zi9rwd6eXkGmsS8zkV ZCeEsv5JZZkNg==
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, 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: <20261126-ksz-stp-link-local-v1-3-39aed15f6271@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
X-Received-Bytes: 12425