From nobody Sun Feb 8 00:06:21 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB20FEC874B for ; Thu, 7 Sep 2023 17:01:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238803AbjIGRBD (ORCPT ); Thu, 7 Sep 2023 13:01:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238598AbjIGRAq (ORCPT ); Thu, 7 Sep 2023 13:00:46 -0400 Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB25D1BD9; Thu, 7 Sep 2023 10:00:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1694106016; x=1725642016; h=from:date:subject:mime-version:content-transfer-encoding: message-id:to:cc; bh=diUzlnvHkwnFRUQDjEqQ8wBxKHMIU3epIc6mBh7MkYE=; b=W88ZpTZX3ekEmNYyKpOaSrSKFPwOTJWkhsCzNGVZ6KXnhRxvcx8087QH hMmvHAUrQYnUQJZSxkSdNSaWNYcAVgnM7IQLYvw1CfPqgKqvq3vxHu6JA PSUDANw81BIJr2wx7CrgFRJIvP6SPurfikYtmf4GzStsLh0l+El8iNAVT avgaI/4XhUeeQqtIHrLnTU20lA3Et3inuH379mcm8nBJ2ziPsPNXbq93t ve8MpuvDbOb7AvjC6lS1sr0wlHcgoPNFYiVuvTABBg5kx6Op7d0oCzJa6 YsOtFfg9sUxF595SjzJVadqmZbfATYKIln+c9f1p7/Vgpjcs5qK5QK69t Q==; From: Vincent Whitchurch Date: Thu, 7 Sep 2023 12:46:31 +0200 Subject: [PATCH net v2] net: stmmac: fix handling of zero coalescing tx-usecs MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20230907-stmmac-coaloff-v2-1-38ccfac548b9@axis.com> X-B4-Tracking: v=1; b=H4sIAAaq+WQC/12Nyw7CIBREf6W5azEUa9O68j9MFzwu9iZSDBBS0 /DvEuLK5ZnJnDkgYiCMcOsOCJgpkt8qiFMHepXbExmZyiC4uPCZDywm56Rm2suXt5ZJLUeFVhk xKKijd0BLexM+YMMESw1XismHTzvJfat+vuu/L/esZyjmSXCcrB3NXe4Uz9o7WEopX1DdP1mwA AAA To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin CC: Felix Fietkau , Maxim Mikityanskiy , , , , , , Vincent Whitchurch X-Mailer: b4 0.12.3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Setting ethtool -C eth0 tx-usecs 0 is supposed to disable the use of the coalescing timer but currently it gets programmed with zero delay instead. Disable the use of the coalescing timer if tx-usecs is zero by preventing it from being restarted. Note that to keep things simple we don't start/stop the timer when the coalescing settings are changed, but just let that happen on the next transmit or timer expiry. Fixes: 8fce33317023 ("net: stmmac: Rework coalesce timer and fix multi-queu= e races") Signed-off-by: Vincent Whitchurch --- Changes in v2: - Rebased on current net/main. - Link to v1: https://lore.kernel.org/r/20230905-stmmac-coaloff-v1-1-e29820= e8ff6d@axis.com --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/ne= t/ethernet/stmicro/stmmac/stmmac_main.c index 9a3182b9e767..2206789802bf 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2704,9 +2704,7 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, = int budget, u32 queue) =20 /* We still have pending packets, let's call for a new scheduling */ if (tx_q->dirty_tx !=3D tx_q->cur_tx) - hrtimer_start(&tx_q->txtimer, - STMMAC_COAL_TIMER(priv->tx_coal_timer[queue]), - HRTIMER_MODE_REL); + stmmac_tx_timer_arm(priv, queue); =20 flags =3D u64_stats_update_begin_irqsave(&tx_q->txq_stats.syncp); tx_q->txq_stats.tx_packets +=3D tx_packets; @@ -2995,9 +2993,13 @@ static int stmmac_init_dma_engine(struct stmmac_priv= *priv) static void stmmac_tx_timer_arm(struct stmmac_priv *priv, u32 queue) { struct stmmac_tx_queue *tx_q =3D &priv->dma_conf.tx_queue[queue]; + u32 tx_coal_timer =3D priv->tx_coal_timer[queue]; + + if (!tx_coal_timer) + return; =20 hrtimer_start(&tx_q->txtimer, - STMMAC_COAL_TIMER(priv->tx_coal_timer[queue]), + STMMAC_COAL_TIMER(tx_coal_timer), HRTIMER_MODE_REL); } =20 --- base-commit: 35494b0d61e44b517178aa1c6f5a69168b086940 change-id: 20230904-stmmac-coaloff-aca6befbd24b Best regards, --=20 Vincent Whitchurch