Article View: linux.kernel.netdev
Article #17060Re: [PATCH net-next v2 1/3] net: dsa: microchip: ksz9477: apply a shorter ageing time at once
From: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 11:00
Date: Mon, 16 Nov 2026 11:00
138 lines
13325 bytes
13325 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
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] In ksz9477_set_ageing_time()
(drivers/net/dsa/microchip/ksz9477.c:1361-1371), the new Fast Aging…
- [Low] The Fast Aging pulse in ksz9477_set_ageing_time() is a fixed
blind sleep: KSZ9477_FAST_AGE_PULSE_US = 2 ms (ksz9477.c:1293),…
--
net: dsa: microchip: ksz9477: apply a shorter ageing time at once
This patch makes ksz9477_set_ageing_time() pulse the Fast Aging bit in
REG_SW_LUE_CTRL_1 for a fixed 2 ms. It does this whenever the programmed
ageing time gets shorter or the Age Count gets smaller. The goal is that
stale entries no longer outlive an STP topology change on a KSZ9893.
> diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
> index 8d4647e23cda1..a9d701f0404a7 100644
> --- a/drivers/net/dsa/microchip/ksz9477.c
> +++ b/drivers/net/dsa/microchip/ksz9477.c
[ ... ]
> @@ -1336,8 +1343,32 @@ static int ksz9477_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)
> return ret;
> }
>
> - value = DIV_ROUND_UP(secs, data);
> - return ksz_write8(dev, REG_SW_LUE_CTRL_3, value);
> + new_period = DIV_ROUND_UP(secs, data);
> + ret = ksz_write8(dev, REG_SW_LUE_CTRL_3, new_period);
> + if (ret < 0)
> + return ret;
> +
> + /* data is the new Age Count and mult is the old one. An entry
> + * stores the Age Count when it is updated. The datasheet does not
> + * say when a new Age Period applies. On a KSZ9893, entries outlived
> + * the new ageing time after it got shorter, and after the Age Count
> + * got smaller. Pulse Fast Aging in both cases. On a KSZ9893 the
> + * pulse removes the dynamic entries (checked on one user port) and
> + * starts the new period.
> + */
> + old_secs = mult * old_period;
> + new_secs = data * new_period;
> + if (new_secs >= old_secs && data >= mult)
> + return 0;
> +
> + ret = ksz_rmw8(dev, REG_SW_LUE_CTRL_1, SW_FAST_AGING, SW_FAST_AGING);
[Severity: Medium]
Does this flush the dynamic FDB entries of every port on the switch?
SW_FAST_AGING is BIT(1) of REG_SW_LUE_CTRL_1 in ksz9477_reg.h. That
register holds only switch-wide lookup engine controls, next to
SW_AGING_ENABLE and SW_LINK_AUTO_AGING. Fast Aging has no port or FID
selector, so each pulse removes dynamic entries on all ports. That
includes ports in other bridges that had no topology change.
When the software bridge shortens its ageing time, it only expires
entries that were not refreshed within the new time. This pulse also
drops entries that are still in use. Unicast traffic to those addresses
then floods until the hosts transmit again, and a host that only
receives can be flooded to for a long time.
The pulse can also fire when the ageing time grows. From the reset value
of 4 x 75 s, a request for 301 s gives:
max_val = 255 (76 * 4 != 301)
data = DIV_ROUND_UP(301, 255) = 2
new_period = DIV_ROUND_UP(301, 2) = 151
data (2) < mult (4), so the switch-wide flush runs although the ageing
time went up from 300 s to 302 s.
Neither the subject nor the body says the flush covers the whole switch.
The commit message only says:
On a KSZ9893 the pulse removed the dynamic entries on the one user port
I tested.
The driver already has a per-port flush, ksz9477_flush_dyn_mac_table(),
which is wired up as .port_fast_age. Could that be used here, or could
the commit message at least say that all ports are flushed?
> + if (!ret)
> + fsleep(KSZ9477_FAST_AGE_PULSE_US);
> +
> + /* Clear the bit even after an error. */
> + err = ksz_rmw8(dev, REG_SW_LUE_CTRL_1, SW_FAST_AGING, 0);
[Severity: Low]
Is a fixed 2 ms sleep long enough on all chips that use this function?
The new define comes with this comment:
/* The datasheet gives no pulse length. A 2 ms pulse worked on a KSZ9893. */
Nothing checks that the dynamic entries are gone before SW_FAST_AGING is
cleared. ksz9477_set_ageing_time() is installed through ksz9477_switch_ops.
That covers many chip_data entries in ksz_common.c, including the 7-port
KSZ9477/KSZ9897/KSZ9567 parts, but it was only tested on a KSZ9893 with
one user port.
The other Fast Aging user in this driver suggests the timing depends on
the chip:
drivers/net/dsa/microchip/ksz8.c:ksz8_flush_dyn_mac_table() {
...
if (ksz_is_ksz8995xa(dev)) {
/* Allow the 800 us fast-age cycle to finish before restoring
* normal ageing and port learning.
*/
...
}
Some untested chips may count each entry's stored Age Count down at a
fast tick, or may need more time to sweep the ALU. If so, could the pulse
end before every entry has expired, so that stale entries still outlive
the topology change?
> +
> + return ret ?: err;
> }
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261115-ksz-stp-ageing-v2-0-7af27320033e%40pengutronix.de
Technical Details
Message-ID:
<179482683512.3136.850497985215218789@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364210-linux-kernel-netdev=dewy.ruReferences:
<20261115-ksz-stp-ageing-v2-1-7af27320033e@pengutronix.de>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364210-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v2 1/3] net: dsa: microchip: ksz9477: apply a shorter ageing time at once Date: Mon, 16 Nov 2026 11:00:35 +0000 Organization: Usenet Network Message-ID: <179482683512.3136.850497985215218789@kernel.org> References: <20261115-ksz-stp-ageing-v2-1-7af27320033e@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2040439"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:88mdnRM5SKeAh0dTrZedS7ySXys= sha256:1q0excc6Dg921As7yfw6anwKye+Rr9Hl/7YjbfUaxK8= sha1:sPLoNYrePPINCrTIdEJO9lAMLyM= sha256:yAGLeCq2uzdIDRp+5qCnFNGbXjUpt6eP0KjpPrUDAQ0= 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 D4638114B2E; Mon, 16 Nov 2026 14:01:02 +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 cf1q01N-lXuD; Mon, 16 Nov 2026 14:00:58 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-364210-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 35343114BAA; Mon, 16 Nov 2026 14:00:43 +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 878463402A; Mon, 16 Nov 2026 11:00:39 +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=1794826838; b=zSPOOU5Nrn/i6rcTdfamQeJNU8gfPiy9NiVETZ0K1thr1fdOeqlpO1ocplm3lnB6JS6/ +ktwcssKIDQYmpzjasPYflUpj8dAH8s1yuyjKITaSIYEeQuqq4IDSFuUkGwm+Zo5k16kp UwZVJMPoCbiRazXNaDpbjAFaaYbfX7GVsu+cJ0fhLxe8cIhwgkCZG3baQU3ky+5mwtr9q dBPoxiYlwXmNu8My3eFgOxdqkfk8E50Fw8NM2TFGs2SDyGO5X5YKbDdxAelr2AsBopwbV vPVeOSaI9KTAkpDoh0jE4GKPR6pgWDhDnAb38F/mMQcqP83q0yZgjYSZKB02KT10Crw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794826838; 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=jRQaov11bNgWz0yrd9PclPsPFo/vCJZ5F4x0YK2Zcjo=; b=l3P3cDtkFDtCrla4trx4elZMr2KLfPqEC3QjeZJBTtsiswrtK7P0W46/FfUgXXIVzAct OE5GcLF9bPIDdoyHQ4Hj2g9Utobg03egZyPO0734Fcsg29xs6zbtB6X2xdiQgwb3LnWjy CVTYMYJEO3J+hsatugduTSFSEdfoSjJDS9WPBy5H6VJ59thuy2s20KBiM0JkqtkusIV/z j0fQOK8qg5oru3y2LtrhHXDwE3RmkVjs7SxeDQlsyXWHRWymW10UU9s2DP7FltRD898IN 3kK16tUH4qDbp9uLMfO4/uot1+LvqSaTRgUrIMYQ/ZVuSHMigKk4nPUh2HVZ6eeYi9A== 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=Ke50lvbv; 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 F0DDC606A889; Mon, 16 Nov 2026 11:00: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=Ke50lvbv 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=1794826837; b=a/LxJLLSIUtlQL2gwRB1o0ZOnzmdi8Qvn+SRV6g+07E2NiLQud2dglI6Enhc+Vgsi1Uk 2piHk/wiultvKg1bymuiFi7int8iAwhoFqxs6m48Zt1Htjewc8FEfuXB8Vn4v7RZZWpz2 XogrC3i2s9T6FP7M13HewrWdrEIRa82XmA9amy1OhFqF1bFR4KJFt7sKQ+bbPVGwX+7uN 1vWoJZmvU9QgbbDirzh1vOsFbFoA4Q8PClXFQRWf9wjsM7PHdRROTx4g5RrkQpg5oPcHK lYmpaPrxBVtkP23bpUV9p6Ndf3O24EPzA9bEFOrpzE1J+fhwmcmEg8sxOX2SBQ5hhiA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794826837; 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=jRQaov11bNgWz0yrd9PclPsPFo/vCJZ5F4x0YK2Zcjo=; b=y3bfyXhvQ5sUo1AdE74tZonuCKr71V4/CyAO7Z6zTmoWC2nmzRuQjpIEmKa5yPjbwS9K DjpaEtEVaXPDRHYpxrP5Kj6kRuk67Sx4C02J4CSU4BbY2/beQTrYRhqMxtXbkAMJwqH/W cH49YtZCSDvdlv3LH7uK8uFJvGBDMD9OtnmnFSBYAgL6GQsWm2tosUNjEsRYgG8W9SKp9 BcmZBHOu9gjo+I01ewYyG9ozvWNwMMZl/kok7uZEy7iI/mibWJfPMBf2XXx5r7BrOXhft l4CBAKsmmvMVl1HqpH5GvCjMOAXu1L75jxx97f7itXQm0pArbOdV2zLVfTEwrP8iKGQ== 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=Ke50lvbv; 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 1CA3A606A336; Mon, 16 Nov 2026 11:00:36 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AE331F000C4; Mon, 16 Nov 2026 11:00:35 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794826836; bh=jRQaov11bNgWz0yrd9PclPsPFo/vCJZ5F4x0YK2Zcjo=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Ke50lvbvWzEtbJQQFsFv7GCmAsYQlc6D7rR9u1AF81EcLg1KizIoA6gS24yZcOfeH HTYsHJ8g8uT2nrc4ODl8Foz6i1QK6F0Ao3x6fmORMG9hBn5FhTbQQ55hR+ogS1oFkM g91FN+1WCf1Jkc8spoIoIDn7W6ib/KhnsN6K7bYBLmaDD/Whe7LT+nQwBom2GW/KA5 eCMrhGsA80DWc+jwG6FpGMYMx6Vyn2jQcRJjCt2mp6TD6+vK1rYOA3hOacAGwWPzds AyGrFdCFbmicQHa/H3cSckIOVzqE6+kcMb1eXEwAkzNb0CNYjyNLBvD5BsMFnKASnh oQS2c2q0Ydngw== 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, arun.ramadoss@microchip.com, jiri@resnulli.us, linusw@kernel.org, f.fainelli@gmail.com, vivien.didelot@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, jensemil.schulzostergaard@microchip.com X-In-Reply-To: <20261115-ksz-stp-ageing-v2-1-7af27320033e@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