Article View: linux.kernel.netdev
Article #21102Re: [PATCH net-next v3 8/9] net: sparx5/lan969x: scale the TAS guard band with the MTU
From: netdev-bot+sashiko
Date: Mon, 23 Nov 2026 14:58
Date: Mon, 23 Nov 2026 14:58
143 lines
13682 bytes
13682 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] sparx5_tas_gb_update()
(drivers/net/ethernet/microchip/sparx5/sparx5_tas.c) takes the largest…
- [Low] In sparx5_tas_gb_update()
(drivers/net/ethernet/microchip/sparx5/sparx5_tas.c:738) the guard…
--
net: sparx5/lan969x: scale the TAS guard band with the MTU
This commit programs the TAS guard band (HSCH_TAS_QMAXSDU_CFG) for all
ports and traffic classes. The value comes from the largest MTU of all
ports, plus the Ethernet header, FCS and two VLAN tags, rounded up to
64 bytes. It adds sparx5_tas_gb_update(), calls it from sparx5_tas_init(),
and makes it available for use when the MTU changes.
> diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_tas.c b/drivers/net/ethernet/microchip/sparx5/sparx5_tas.c
> index ec80bc69371ab..32e502bc4f18f 100644
> --- a/drivers/net/ethernet/microchip/sparx5/sparx5_tas.c
> +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_tas.c
[ ... ]
> @@ -718,6 +721,40 @@ int sparx5_tas_disable(struct sparx5_port *port)
> return err;
> }
>
> +/* Size the guard band of all ports for a frame of the largest MTU of all
> + * ports, as a port can transmit frames forwarded from any port.
> + */
> +void sparx5_tas_gb_update(struct sparx5 *sparx5)
> +{
> + u32 max_mtu = 0, gb;
> + int i, tc;
> +
> + for (i = 0; i < sparx5->data->consts->n_ports; i++) {
> + if (sparx5->ports[i])
> + max_mtu = max_t(u32, max_mtu,
> + READ_ONCE(sparx5->ports[i]->ndev->mtu));
> + }
> +
> + gb = DIV_ROUND_UP(SPX5_HW_MTU(max_mtu) + 2 * VLAN_HLEN,
> + TAS_QMAXSDU_UNIT);
[Severity: Low]
Should the 8 byte preamble/SFD be counted here?
The guard band is sized from the L2 frame only, F = mtu + 26, rounded up
to 64 bytes. A frame of F bytes that starts just before the guard band
needs F + 8 byte-times on the wire to finish.
When F mod 64 is 0 or 57..63, the rounding leaves less than 8 bytes of
slack. For example, mtu=2022 gives F=2048 and mtu=9190 gives F=9216, both
with no slack. mtu=4000 gives F=4026, with 6 bytes of slack.
Suppose the HSCH turns QMAXSDU_VAL * 64 directly into time at LINK_SPEED,
without adding L1 overhead itself. Could a maximum size double tagged
frame then overrun the gate close by up to 8 byte-times? The default MTU
of 1500 is fine (1526 vs 1536).
For comparison, felix/vsc9959 adds L1 overhead explicitly when it
calculates the guard band. The tree doesn't show whether the
sparx5/lan969x hardware adds the preamble time internally.
> +
> + mutex_lock(&sparx5->tas_lock);
> +
> + /* Each port uses the TAS profile of its own number */
> + for (i = 0; i < sparx5->data->consts->n_ports; i++) {
> + if (!sparx5->ports[i])
> + continue;
> +
> + for (tc = 0; tc < SPX5_PRIOS; tc++)
> + spx5_rmw(HSCH_TAS_QMAXSDU_CFG_QMAXSDU_VAL_SET(gb),
> + HSCH_TAS_QMAXSDU_CFG_QMAXSDU_VAL,
> + sparx5,
> + HSCH_TAS_QMAXSDU_CFG(i, tc));
[Severity: Medium]
What happens to taprio schedules already offloaded on other ports when
this loop rewrites the guard band?
The loop writes the new guard band into every port's profile for all 8
traffic classes. That includes ports whose lists are already pending or
operating. sparx5_tas_init() sets ALWAYS_GUARD_BAND_SCH_Q, so the guard
band applies to every class:
sparx5_tas_init() {
...
spx5_rmw(HSCH_TAS_CFG_CTRL_LIST_NUM_MAX_SET(list_num_max) |
HSCH_TAS_CFG_CTRL_ALWAYS_GUARD_BAND_SCH_Q_SET(1),
...
}
Later in this series, "net: sparx5/lan969x: add support for changing the
MTU" calls sparx5_tas_gb_update() from sparx5_port_change_mtu(). After
that, "ip link set dev ethB mtu 9000" raises the guard band on every port
from 1536 to 142 * 64 = 9088 bytes. That is about 72.7 us at 1 Gbps and
727 us at 100 Mbps. At the maximum MTU it reaches 219 * 64 = 14016 bytes.
Take a schedule on ethA with a 20-50 us window at 1G. It works with the
1536 byte guard band (about 12.3 us). The commit message notes that the
scheduler starts no frame inside the guard band.
After the MTU change on ethB, wouldn't that window never open? The queue
would then fill and tail-drop, and no error would be reported.
sparx5_tas_gb_update() returns void and doesn't recheck the programmed
lists. sparx5_tas_enable() checks intervals only against
TAS_MIN_CYCLE_TIME_NS and TAS_MAX_CYCLE_TIME_NS, not against the guard
band, so such schedules are also accepted without a warning:
sparx5_tas_enable() {
...
if (interval < TAS_MIN_CYCLE_TIME_NS) {
...
}
The taprio max_sdu[] values, which correspond to this register, are also
ignored. So the guard band can't be limited per class.
felix/vsc9959 handles this in vsc9959_tas_guard_bands_update(). It
recomputes the per-TC QMAXSDU from the schedule's minimum gate lengths
whenever the MTU or the schedule changes. It also enables oversize
dropping, so short windows can still carry smaller frames.
Using the switch-wide maximum MTU seems reasonable, since ports forward
and mirror frames from each other. The concern is only that running
schedules can stop transmitting without any error.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120-sparx5-mtu-change-v3-0-55c272fe1acc%40microchip.com
Technical Details
Message-ID:
<179544590174.3135.13752120910636082921@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369510-linux-kernel-netdev=dewy.ruReferences:
<20261120-sparx5-mtu-change-v3-8-55c272fe1acc@microchip.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369510-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v3 8/9] net: sparx5/lan969x: scale the TAS guard band with the MTU Date: Mon, 23 Nov 2026 14:58:21 +0000 Organization: Usenet Network Message-ID: <179544590174.3135.13752120910636082921@kernel.org> References: <20261120-sparx5-mtu-change-v3-8-55c272fe1acc@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3907250"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:XKvVXguclu1voUNnmwUGB3sa55o= sha256:6IGBdZknVfdHAdTr+bPlkMydQJrJULbBvHWbPhapwGY= sha1:qtLJ9CznsXyAHQnM12WO2Fe9PSs= sha256:qBP+hNprwDALLhguwDWWIn7a0fqBJTgzyC7pwx35MhY= 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 88419125DBD; Mon, 23 Nov 2026 17:59:09 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 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, 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 o15682mRIU2k; Mon, 23 Nov 2026 17:59:02 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-369510-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 28CEC125DBB; Mon, 23 Nov 2026 17:58:50 +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 A30A026AAE; Mon, 23 Nov 2026 14:58:37 +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=1795445905; b=WdA63cVeOWGNmC7P4r7CgTIBvZawAF9GsAL0it+4LdrIjxXDBjhH6EtArQLzTBSG5bVu +utHzrgF4CMDB7CnJnNW6tLurVgLF8ttC/7x33x48/H1o1LMMVSVDocQO3GLWl1JCBQc+ tRoZ8xtHzg31BHkFieW6UC/mi807XWQKfSHQ9HZ58DPToR0VSLYKhWX7fMfKYgxUo30DH ACLJLKjeLUYkxb6aQaUVHbZ/UAbBPedtEFjvTIBkX174djaNg2ArdhijK1RPoh5SBTJeB uPi7vdLZ45YBVg1u47pRqxneGQQptRIWKmx1/74KbsPwJV+ELy1eg3rzyJDz09P0rzw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795445905; 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=JHXeULIVQNGIXkg/gHNyxlKSvwy0n+U/9gspP4hp0zQ=; b=Nt9/W4Z8AOM0qIssdz0nuH+VeiJT7U6BfGmPeQx2jHvB7KVOuxATz9wdNWXZ/Ra++hli mu1sjHS8NwWp/ZhuY9y8zGxvJo42W2+vuqWn9radEi5PSzowzbDPB3AX7omzsAqnszWd5 RHsadH4Aq4NxzLOXYSu9mdbkMgod7IADkKUKO+/q0slab0eV2oo5ZG8qXmKzIn0Q7YmwJ odL0brLB0vR71dHDi18l63QaxTqAZwIuvLctzALwX6rAovujWpzP5akGYruCEdfTkAKL/ qYrKb+VUiUUI7XyyPbI2KH3+xamcND/Yew+qpqtj0c8JbFvsJmZzFUfS0KXCBZstUCA== 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="h9eopam/"; 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 E31A8606A68B; Mon, 23 Nov 2026 14:58:24 +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=h9eopam/ 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=1795445904; b=0lZBCIMA14aEFNy3pNBmFHMIG3gEGw0JC7ZZjbcb/UZbxzeQg5aRQWl8I9LWkEO6n1Aa lvGIgx59fpTjjykw7mMtHuUFdJI1qESeOatJBJia5N1BsMiWwrsoO0p7BQwmU/cr3x0Jo mcXWEFPIbmbnkUGDYFReVbjDDjTsnG26IkVdiDEMrVbB6c4nYLSsuZk5HcFN3HZ/DF9Pj Va/Zg9ivxXyHtml2NUd7n/A8hAfMwXAdWGOWe1kQssYW0MgTTlTSYiRik2U1j7bChz6US f1UL8T1aexeel3HfFcJ0DODHNJS3qjIfX5wBZrDjYVGswLHpNRM889WDP9XO/BfXpjg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795445904; 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=JHXeULIVQNGIXkg/gHNyxlKSvwy0n+U/9gspP4hp0zQ=; b=CMnG/hypH0AbLZzVoGEaJ1Dwr3O7YewCbQcwQH3b9IeNNNGkLUTPCDg2HeUOgwMAliA7 Mekrlv10N0KnueOjhNoplSRvJ729MUjE6Ldhs5I8n1swbJXb7FXOuCKgPc2OeAZVTWeUG LfpTIKhSPIt3buRmwIo4fPCdIBk+n3QqiCOdfV34InFnEQUhjfB8hLsUmEY/XbxxN3YKA TL7u3ERpHjPq3g8h5rjtNXG6jYsVlj/upW92v5v+3eSwY93w80V24/2tMcxrPQsv++qWZ gUttAW48pkjqFC5ePxK2+bPcSnm8zHFBrtMKABgXWl+YunCqhMCZGfh/HIorOw6FY9w== 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="h9eopam/"; 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 0F7F9606A6AF; Mon, 23 Nov 2026 14:58:23 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AA791F000E6; Mon, 23 Nov 2026 14:58:22 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795445903; bh=JHXeULIVQNGIXkg/gHNyxlKSvwy0n+U/9gspP4hp0zQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=h9eopam/9BaQtoy2o9kETxgS9rKnidAWxZI6v6Zl2EQlCIKJJiyaMdmtsKf+FjChb 7aDlFzZReYBzKrU4SbMH8Sz0AyNafHJmq7SOMWqnEg67GALkaaTSmTmoCUN8Rig5E5 /sznT28wrFpm9TWFExhKLqjmQj6Pw0pvMQrp2fEba9mtoyebJ+YFShr5Wk0/nUiM1C Hult1fQc0aenaz6jetYgETtqKTsEQSO9SEJHQzduEYDsZzI6ddn24upJmn63XgBuzh KcYchdDwhQg4PbSYf5eNWBopIdQEe9N58wVVmcUEecLVq+h4mPuegyCdL4t+JWBOkB xO5xOsF0AFH2w== X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, Steen.Hegelund@microchip.com, UNGLinuxDriver@microchip.com, richardcochran@gmail.com, linux@armlinux.org.uk, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, robert.marko@sartura.hr, horatiu.vultur@microchip.com, jensemil.schulzostergaard@microchip.com, horms@kernel.org X-In-Reply-To: <20261120-sparx5-mtu-change-v3-8-55c272fe1acc@microchip.com> 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