From nobody Thu Oct 2 00:57:47 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3309C1E503D; Thu, 25 Sep 2025 14:06:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758809188; cv=none; b=MlMz7+2mKh2XAJ6b0LWRXqNuCZFUdN+WtoNLC/0aHoEXDLKmKjrnVwYKA/N41XAdoRDsco1nuI72lFuPs+c4J1JvjqSA44NKlvzUKCpmyTvqRvnQUwW0QijasS2/Jy0qyx0ZXcO1fhv08dq20qtoKF5LHNAhz63A9yRM2nbtCyU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758809188; c=relaxed/simple; bh=zSY/958KOCpOwFRxar6kTLevxJFIWpMxyuGHYhwxU7k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bZM8fC4DmGLDNjtJy5bt65ilT4U0cTIFs1MnpOQy/kfAeBPIiJIXmnGa6jHdyPmtYeIhE8vUT7ssbGVqcbrnmxoyDTiV16yj4g9HuBBaalsRUQZxcQ442213jcbVWpZ+XCcld1FSrLPotymXT2LtOgybi7rcpFGl8HX83/xx718= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tiPz4dJA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tiPz4dJA" Received: by smtp.kernel.org (Postfix) with ESMTPS id CBAC1C4CEF7; Thu, 25 Sep 2025 14:06:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758809187; bh=zSY/958KOCpOwFRxar6kTLevxJFIWpMxyuGHYhwxU7k=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=tiPz4dJA953Eq7WiiXNtY8Da30yNCIhru9tzAm1DI+1ynLbFstBbJYfR4g8TDh58l ZJgNm46swAELQTb96Kxq0JPV091OHhtfCAwTgOvM+/ChwjHqSKoDovJfeEgSvWHzSV 2qz7sXJL3Wu4MAk75vwKFfn+4tuVga3ZVXKbz2aVhg/YSiKZwCitg08YOdnpk5/cdK SKoYBxqhXZVE4hW5LyQ7GHeFUMFkX6Nl7iyZd5dj+cxvJrcSI0i5wC8cTeIdpHPsbi +krgt+kPpndBKfBywNyzG5GrqoxYUUQ3zMkAPLGwhaaeLaNkewW6qsr3Ygn09/860D azuchr7Sxkk4Q== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD4FACAC5A7; Thu, 25 Sep 2025 14:06:27 +0000 (UTC) From: Rohan G Thomas via B4 Relay Date: Thu, 25 Sep 2025 22:06:13 +0800 Subject: [PATCH net-next v3 1/2] net: stmmac: est: Drop frames causing HLBS error Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250925-hlbs_2-v3-1-3b39472776c2@altera.com> References: <20250925-hlbs_2-v3-0-3b39472776c2@altera.com> In-Reply-To: <20250925-hlbs_2-v3-0-3b39472776c2@altera.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexandre Torgue Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Rohan G Thomas , Matthew Gerlach X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1758809186; l=3161; i=rohan.g.thomas@altera.com; s=20250815; h=from:subject:message-id; bh=U2GpYPDapoJb67AF7YZfXLYJz7u/9hkBR8xWCl+t188=; b=k7vpTLnNXsMkDiKz+37H6mNODT5JstRk2/Veg+ISYJlBI6kE6Em5cTVhPKrovC0m83vJYK9pg uymIw+ThuLqDYqtYTtCsxFuIMmr7jI34nwSYdAqkxGEOKIcAdq58ONL X-Developer-Key: i=rohan.g.thomas@altera.com; a=ed25519; pk=5yZXkXswhfUILKAQwoIn7m6uSblwgV5oppxqde4g4TY= X-Endpoint-Received: by B4 Relay for rohan.g.thomas@altera.com/20250815 with auth_id=494 X-Original-From: Rohan G Thomas Reply-To: rohan.g.thomas@altera.com From: Rohan G Thomas Drop those frames causing Head-of-Line Blocking due to Scheduling (HLBS) error to avoid HLBS interrupt flooding and netdev watchdog timeouts due to blocked packets. Tx queues can be configured to drop those blocked packets by setting Drop Frames causing Scheduling Error (DFBS) bit of EST_CONTROL register. Also, add per queue HLBS drop count. Signed-off-by: Rohan G Thomas Reviewed-by: Matthew Gerlach Reviewed-by: Furong Xu <0x1207@gmail.com> --- drivers/net/ethernet/stmicro/stmmac/common.h | 1 + drivers/net/ethernet/stmicro/stmmac/stmmac_est.c | 9 ++++++--- drivers/net/ethernet/stmicro/stmmac/stmmac_est.h | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/eth= ernet/stmicro/stmmac/common.h index eaa1f2e1c5a53b297b014a8218bf8f3db5beb4de..8f34c9ad457f07553206841223f= d38e55208d5ab 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h @@ -228,6 +228,7 @@ struct stmmac_extra_stats { unsigned long mtl_est_btrlm; unsigned long max_sdu_txq_drop[MTL_MAX_TX_QUEUES]; unsigned long mtl_est_txq_hlbf[MTL_MAX_TX_QUEUES]; + unsigned long mtl_est_txq_hlbs[MTL_MAX_TX_QUEUES]; /* per queue statistics */ struct stmmac_txq_stats txq_stats[MTL_MAX_TX_QUEUES]; struct stmmac_rxq_stats rxq_stats[MTL_MAX_RX_QUEUES]; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_est.c b/drivers/net= /ethernet/stmicro/stmmac/stmmac_est.c index ac6f2e3a3fcd2f9ae21913845282ff015cd2f7ec..4b513d27a9889046e8b5e404adf= d917f469c3f05 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_est.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_est.c @@ -63,7 +63,7 @@ static int est_configure(struct stmmac_priv *priv, struct= stmmac_est *cfg, EST_GMAC5_PTOV_SHIFT; } if (cfg->enable) - ctrl |=3D EST_EEST | EST_SSWL; + ctrl |=3D EST_EEST | EST_SSWL | EST_DFBS; else ctrl &=3D ~EST_EEST; =20 @@ -109,6 +109,10 @@ static void est_irq_status(struct stmmac_priv *priv, s= truct net_device *dev, =20 x->mtl_est_hlbs++; =20 + for (i =3D 0; i < txqcnt; i++) + if (value & BIT(i)) + x->mtl_est_txq_hlbs[i]++; + /* Clear Interrupt */ writel(value, est_addr + EST_SCH_ERR); =20 @@ -131,10 +135,9 @@ static void est_irq_status(struct stmmac_priv *priv, s= truct net_device *dev, =20 x->mtl_est_hlbf++; =20 - for (i =3D 0; i < txqcnt; i++) { + for (i =3D 0; i < txqcnt; i++) if (feqn & BIT(i)) x->mtl_est_txq_hlbf[i]++; - } =20 /* Clear Interrupt */ writel(feqn, est_addr + EST_FRM_SZ_ERR); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_est.h b/drivers/net= /ethernet/stmicro/stmmac/stmmac_est.h index d247fa383a6e44a5a8371dd491eab5b1c99cd1f2..f70221c9c84afe6bce62782c784= 7a8005e469dd7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_est.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_est.h @@ -16,6 +16,7 @@ #define EST_XGMAC_PTOV_MUL 9 #define EST_SSWL BIT(1) #define EST_EEST BIT(0) +#define EST_DFBS BIT(5) =20 #define EST_STATUS 0x00000008 #define EST_GMAC5_BTRL GENMASK(11, 8) --=20 2.35.3 From nobody Thu Oct 2 00:57:47 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4DE6828640C; Thu, 25 Sep 2025 14:06:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758809188; cv=none; b=DU/1tQZRrVc+YhmpKF7+JPT7rHonIDbbHQMUCfbeNceX0V9Dk71chvxB56VELUp+Xr3x8MxmDva/53vEOT+ql/f4buvMqV9h6K6aLbDIgpC3rhStO4nmKxqEdmgQSnBzvN42aMCCDHDmo2BvaGC9CtV2c6VN7hGclPof+ghBLtY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758809188; c=relaxed/simple; bh=HV1fJPRFrPlcadQzhmD0w45w8XUYKAzZp4nL/8OX/sU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nx7RTUaYDeIktto1/F/5EjYI8h2iDbAJDxkPlUb05DW0XFMadhcw/rqs+Lf6dBTRlSl2Cs0w3tyaZfbOn2q7KQgAV0/LQ1DWpdhWNa0fKEvUhECGXz6LaeJ7qzYe3owErpTiakvLHlNow0k0rVThTr5u1ukOf3H34z0N9PwJo3A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AZXV4PyE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AZXV4PyE" Received: by smtp.kernel.org (Postfix) with ESMTPS id DAC92C116D0; Thu, 25 Sep 2025 14:06:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758809187; bh=HV1fJPRFrPlcadQzhmD0w45w8XUYKAzZp4nL/8OX/sU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=AZXV4PyEfHJIAOnyxSkujQNWdCnF1+t0zf438VaaaJxiOkVeZAQ2bhk4zWXwks32S xCtuq4ZUx7iRijmMNrn9R9iuIxGkClsa4QpFc3rq7wjqsNURc4HuTOvi8iuG/bfDrc xz4LqWlW0QNWGnlEoJR2/kVqQH0UMEzYKacUQGEUA50J1vNIETIZb6Pddfxb2E8lam K/H79239LrutrQYv+yFXTmha4wK7+NmaX2iT1RmWsoi6+C8I3YkzOr0k40e6B1+joa US5G3dPMN5hAb19htIfLNuuZAPQjNMEKkNsboWDcjo4KDEbOe942rVcZ0Kk+nacgtu XvRuD6GGq2acw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD778CAC5B7; Thu, 25 Sep 2025 14:06:27 +0000 (UTC) From: Rohan G Thomas via B4 Relay Date: Thu, 25 Sep 2025 22:06:14 +0800 Subject: [PATCH net-next v3 2/2] net: stmmac: tc: Add HLBS drop count to taprio stats Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250925-hlbs_2-v3-2-3b39472776c2@altera.com> References: <20250925-hlbs_2-v3-0-3b39472776c2@altera.com> In-Reply-To: <20250925-hlbs_2-v3-0-3b39472776c2@altera.com> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexandre Torgue Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Rohan G Thomas , Matthew Gerlach X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1758809186; l=1901; i=rohan.g.thomas@altera.com; s=20250815; h=from:subject:message-id; bh=yQq3VlBwoMaeIk8RqufK4UtuoZY2MJJUDQlkLWwWmPU=; b=hMdALF2Fprn4xVt2wKIRH3p+R12E3UBo6KtGBycM/0VaCD43UCQOfL6aRH7GT37DTEzaquy94 rybizx/a9NfB7Wi/Vz9npKmXRfGA6OTViRZojhai+kF+f2vKAwnzA0S X-Developer-Key: i=rohan.g.thomas@altera.com; a=ed25519; pk=5yZXkXswhfUILKAQwoIn7m6uSblwgV5oppxqde4g4TY= X-Endpoint-Received: by B4 Relay for rohan.g.thomas@altera.com/20250815 with auth_id=494 X-Original-From: Rohan G Thomas Reply-To: rohan.g.thomas@altera.com From: Rohan G Thomas Add the count of the frames dropped by Head-Of-Line Blocking due to Scheduling(HLBS) error to taprio window drop count stats. Signed-off-by: Rohan G Thomas Reviewed-by: Matthew Gerlach Reviewed-by: Furong Xu <0x1207@gmail.com> --- drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/= ethernet/stmicro/stmmac/stmmac_tc.c index 694d6ee1438197bd4434af6e9b78f022e94ff98f..97e89a604abd7a01bb8e904c38f= 10716e0a911c1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -1080,6 +1080,7 @@ static int tc_taprio_configure(struct stmmac_priv *pr= iv, for (i =3D 0; i < priv->plat->tx_queues_to_use; i++) { priv->xstats.max_sdu_txq_drop[i] =3D 0; priv->xstats.mtl_est_txq_hlbf[i] =3D 0; + priv->xstats.mtl_est_txq_hlbs[i] =3D 0; } mutex_unlock(&priv->est_lock); } @@ -1097,7 +1098,8 @@ static void tc_taprio_stats(struct stmmac_priv *priv, =20 for (i =3D 0; i < priv->plat->tx_queues_to_use; i++) window_drops +=3D priv->xstats.max_sdu_txq_drop[i] + - priv->xstats.mtl_est_txq_hlbf[i]; + priv->xstats.mtl_est_txq_hlbf[i] + + priv->xstats.mtl_est_txq_hlbs[i]; qopt->stats.window_drops =3D window_drops; =20 /* Transmission overrun doesn't happen for stmmac, hence always 0 */ @@ -1111,7 +1113,8 @@ static void tc_taprio_queue_stats(struct stmmac_priv = *priv, int queue =3D qopt->queue_stats.queue; =20 q_stats->stats.window_drops =3D priv->xstats.max_sdu_txq_drop[queue] + - priv->xstats.mtl_est_txq_hlbf[queue]; + priv->xstats.mtl_est_txq_hlbf[queue] + + priv->xstats.mtl_est_txq_hlbs[queue]; =20 /* Transmission overrun doesn't happen for stmmac, hence always 0 */ q_stats->stats.tx_overruns =3D 0; --=20 2.35.3