🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #20502

Re: [PATCH net-next v7 1/3] net: macb: cache ENST config across link down/up

#20502
From: netdev-bot+sashiko
Date: Sun, 22 Nov 2026 20:01
112 lines
12696 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 macb_mac_link_up()
  (drivers/net/ethernet/cadence/macb_main.c:1051), if the link comes…
- [Low] The commit message describes a user-visible defect in the
  existing TAPRIO offload, but the patch has no Fixes: tag.

--

net: macb: cache ENST config across link down/up

This patch caches the TAPRIO/ENST schedule in bp->enst and writes it
again from macb_mac_link_up(). If the link speed has changed, the cached
schedule is dropped instead. It also caches the link speed in
bp->speed_mbps, serialises taprio replace/destroy with bp->mac_cfg_lock,
moves the per-queue config from kmalloc to the stack, and removes the
pm_runtime_suspended() check.

> This causes trouble if the config is not compatible with the new open
> and link-up. The two issues that can occur are a link speed change (as
> all timings are configured in a unit relative to the link speed) or a
> change in the # of queues.

[Severity: Low]
Should this patch have a Fixes: tag?

The behaviour described here goes back to commit 89934dbf169e ("net:
macb: Add TAPRIO traffic scheduling support"). In that code, the ENST
registers are written only from macb_taprio_setup_replace(), using the
link speed at the time of the tc command. Nothing rewrites them on
link-up.

So after the link renegotiates to a different speed, the byte-unit
ON/OFF timings stay in hardware unchanged. The gate windows are then
off by the speed ratio, for example 10x for 1000 -> 100. If register
state is lost across close/open, the schedule silently stops being
enforced.

This patch depends on newer infrastructure (bp->mac_cfg_lock,
bp->link_up), so it may not backport as-is. Even so, would a Fixes: tag,
or a note on why this is net-next only, help record that released
kernels have this problem?

> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index 9f6111661b40d..1e06666921160 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c

[ ... ]

> @@ -1009,6 +1048,15 @@ static void macb_mac_link_up(struct phylink_config *config,
>  
>  	spin_unlock_irqrestore(&bp->lock, flags);
>  
> +	if (bp->enst.speed_mbps && speed != bp->enst.speed_mbps) {
> +		netdev_warn(bp->netdev,
> +			    "TAPRIO dropped because link speed changed\n");
> +
> +		memset(&bp->enst, 0, sizeof(bp->enst));
> +	}
> +
> +	macb_apply_enst_config(bp);
> +

[Severity: Medium]
What happens to the installed taprio qdisc when this branch is taken?

If the link comes back up at a speed other than bp->enst.speed_mbps,
the cache is zeroed. macb_apply_enst_config() then writes the disable
bits for every queue into ENST_CONTROL and zeroes each queue's
ENST_START_TIME, ENST_ON_TIME and ENST_OFF_TIME.

The taprio layer is not told about this. The qdisc stays installed in
full offload mode, so tc keeps reporting a hardware-enforced gate
schedule that the MAC no longer applies.

The schedule also does not come back if the link returns to its
original speed. Take 1000 -> 100 -> 1000: after the first change,
bp->enst.speed_mbps is 0, so this check is skipped and the zeroed cache
is applied again. Gating stays off until the user reinstalls the qdisc.

Nothing can recompute the schedule later, because struct macb_enst only
stores byte units. macb_taprio_setup_replace() converts the nanosecond
values and then throws them away:

    config.queues[queue_id].on_time_bytes =
        enst_ns_to_hw_units(entry->interval, bp->speed_mbps);
    config.queues[queue_id].off_time_bytes =
        enst_ns_to_hw_units(off, bp->speed_mbps);

Could entry->interval and off be cached in nanoseconds instead? Link-up
could then recompute the byte values for the new speed with
enst_ns_to_hw_units() and check them again against
enst_max_hw_interval(). A lower speed only raises the hardware limit,
so the schedule would only have to be dropped when it really no longer
fits.

The later patches in this series that add set_channels and the Tx SRAM
segment distribution do not change this path.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118-macb-set-channels-v7-0-2dbc00f686af%40bootlin.com
Technical Details
Message-ID: <179537769127.3135.3406600332849226108@kernel.org>
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!srl.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-368800-linux-kernel-netdev=dewy.ru
References: <20261118-macb-set-channels-v7-1-2dbc00f686af@bootlin.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!srl.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-368800-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v7 1/3] net: macb: cache ENST config across link down/up
Date: Sun, 22 Nov 2026 20:01:31 +0000
Organization: Usenet Network
Message-ID: <179537769127.3135.3406600332849226108@kernel.org>
References: <20261118-macb-set-channels-v7-1-2dbc00f686af@bootlin.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3712936"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:LuX470UdH8WtQsOsCCbcUymJl0I= sha256:022+6jo4nPR2TaQfMYeMFzFlRfnwOYGd5lpTeNZM66A=
	sha1:K61kBuuy5IY+ET97PjSc0QH8kxw= sha256:iO9z/K/SS1i8CTU4E+j0MZBM9E1SO8CifadBKj3B/1Y=
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 9DFAD125D85; Sun, 22 Nov 2026 23:02:00 +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 QR8rJbGJvnxx;
	Sun, 22 Nov 2026 23:01:57 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-368800-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id C0619125D82; Sun, 22 Nov 2026 23:01:48 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id E8E512BB75; Sun, 22 Nov 2026 20:01: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=1795377693;
	b=ZaYxuwGdu2Cw5WEOONv77CKCWIoksisAqzmlABgu9gCmngrbY/hL+drfTDBxc2Cy2qaX
	 Ncv+5HoI4pOj2CFS9u1pgkwqzYhqAUQxDloeqQ3ow767BG4JfndJTKXAL3GvYfbGTBCs0
	 HGeywbB6xrvaGA0oMkGx987uf9/jtoNWJZKQbVO35u85MMKAtHP4X/3o6ObuQS4uSgC4D
	 aTXxnycjBlHj4Nyk/STTnUfVlCeNVN8FR9K79mAej1IHQEQ/Fnu6MSAOIJr6wJmCUS11I
	 gSCpLWbQBx5ZR17c82LtI6Gpj5YShgnxqPBbLoNXuHcS6LVeQS0gfsZH9qoUVAH1GrA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795377693;
	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=ZmXFmGYYUTSy92iO1DLvq3rahLhGYek7nLjORxdp2X4=;
	b=t7M9gsMDN7RSO/FsgDIYiYybhu1WJHhzZhKs+0Az9sTLmVhN36fSTg9aGEm5X2OAPFZi
	 eii17zt+kt8g7sZRzTNMExjxmWn/ip4Yu8759k65p+Vju7jsXIWZroI3FQUkjEahTNqVo
	 d3XNiYoIF33CT36NOw+hOy9aDJoZkYmkQyD4wbug8+uZLTL8uS1FU1K2MjC9daZETKLTz
	 lsz3N06wkg0MzZm62QBRa84AGK6pKeUOjndprYtx5ZeBlxeuipJPdLYa2V+IoqvxtJ1n4
	 a68Uo9d8hAIFrVLV8nD6QLN+kvPkW1jqbvHiNiB3/f6/PRdTTzZ1nO9hftOXFGNixoQ==
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="I5/QcWRt";
	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 9E603606A33E;
	Sun, 22 Nov 2026 20:01:33 +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=I5/QcWRt
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=1795377692;
	b=v302Ck64Ep1UctBLqruN63WlzURPONZbEiEWvgz/3ri896Usj9Nz2kYDFjtHoJOPlsdP
	 eaKsB8Yg4CkYYqXfNY4vBU0XIKbFBY7O1BHjtEHticDKzoCeCERRUKV+ywslkD8EImUPb
	 yQ6Aa0klm2pXBejGqMLnwkodn0jhFe792hhrkMjmC7/mz734cFVjz2ogzY3Ci67N1z26D
	 klEROa5c7Bjitsbq8rl0vYexreawTxt5GCHFajAJLRwVkwUN1HFhskxmzEYPKjlw2z3hh
	 ojsrYoPjn3G7QvIfrEeqJs7cNnV2KmDM1Ku1CWtAO+5tS249FZZebgMOBjNgDkbOkaw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795377692;
	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=ZmXFmGYYUTSy92iO1DLvq3rahLhGYek7nLjORxdp2X4=;
	b=t3xOa321qPveuM8nJ1iSSxQrPBGzdGSfsbhVAzNpwkm+ALSLLapho4Tkg68PZNSngkci
	 /QRksm4xgDi4iDWFe6Ky1IOLPyl+5sXzlR50OllkZayVoArYkcUU6bs+suEz52WDRPZUp
	 hgKBv09modLLUoCPfQ8c9a2ZGQZW7wwwlNLUGMWQ7BbHZIf49T5LZ150hrRYZEIKQVB1a
	 RqrXwuC9DBOBFNe3aVZ+ocn/MUQfLZF3FduaQrMY28xBbXx2ub6xK/yT0sbDrayyA3zY6
	 f2mmn0XcPolq1o6PJ9zr7Z1L9xMiXTnXShxZInM30eOqcK92+SaJKVwPyHAINUOj5Lg==
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="I5/QcWRt";
	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 BF9B3606A333;
	Sun, 22 Nov 2026 20:01:32 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id B49FE1F000CF;
	Sun, 22 Nov 2026 20:01:31 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795377692;
	bh=ZmXFmGYYUTSy92iO1DLvq3rahLhGYek7nLjORxdp2X4=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=I5/QcWRtvAIlbtNNwyaCrQcxPiuUdxYhJ5PzoWCTqcSS8+2yTpq3bNv9rPMGpUwL9
	 zxMkW5eb1OlI/ovfmiqKxzGHc57vD1AEu666RNZS0DT1clSaLGNu/ZAZDnkKuEgkPU
	 F2t0G//YZSWVkSS/px+PeBGLACO4GpjYCBP6naZ5AQBm2Ar4ODIzL9h066YYtJEkVg
	 LZthX6SvXwKp7k28AkpsdUcRCKI9SFrMqoIxQHHiwJMLx+Jd7ZkkiMcq669RzLPWNI
	 3vCcK5HZ3IsClYB18R4bIcnH3hDzWwYW8KWcy3SFZUYxVSN+HTLN5odYDu1r4gmUAb
	 SINbg/XJdy3Jg==
X-Cc: conor.dooley@microchip.com, andrew+netdev@lunn.ch, davem@davemloft.net,
 edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 linux@armlinux.org.uk, netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
 nb@tipi-net.de, pvalerio@redhat.com, vladimir.kondratiev@mobileye.com,
 gregory.clement@bootlin.com, benoit.monin@bootlin.com,
 tawfik.bayouk@mobileye.com, thomas.petazzoni@bootlin.com
X-In-Reply-To: <20261118-macb-set-channels-v7-1-2dbc00f686af@bootlin.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