From patchwork Thu Sep 7 10:46:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Whitchurch X-Patchwork-Id: 13376349 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 74E79C83F17 for ; Thu, 7 Sep 2023 10:47:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:CC:To:Message-ID:MIME-Version:Subject: Date:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=W/STE4quTNOgCkeCpbQQwVgUrHFoH15u807jPglpFds=; b=qTv0ySZiBO0O2e oo+XzV8V3g4qa07ZgW+SJV6gIjq/A8zYbTLo/OnN89ublWwWcF409Y1/IWsdnAJFfAd6f1jfxG7Oi 3HIPgXgugeZe7sGBrZUsiq99csqICc/QmRwaat5Hc90tTYzXo8r1NuBpdrCFaPiuiImowmhPN0Fsb yYGz7c+eX5fk5CUi3tplDZI69i5ddAR+rZy6HduB0wrlsG/zKAlm4JL/CSPxtvFZaBv1pcOj39a+q Ngc53ila136C7xEUK1jbhx690Po+/3Jhp7XgVmGJt/9yy7XpZKKLxw3yTnkVSwRIMsDaO6FsPWlzB A6hQW/nE6IudlSwoGHCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qeCX9-00BpBD-02; Thu, 07 Sep 2023 10:46:47 +0000 Received: from smtp1.axis.com ([195.60.68.17]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qeCX6-00Bp3L-0V for linux-arm-kernel@lists.infradead.org; Thu, 07 Sep 2023 10:46:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1694083604; x=1725619604; h=from:date:subject:mime-version:content-transfer-encoding: message-id:to:cc; bh=diUzlnvHkwnFRUQDjEqQ8wBxKHMIU3epIc6mBh7MkYE=; b=ZZPeB4Mr6wv1rLSdGyrwh606JQNqvOtQBB8cghDqUpld863AG1LyHJKz O1RhyMV9WMxT6lxbMZ1bpii6NlNO6YqsPEcfIMkSB9W7bopJ+Sm440oE+ 8VYPOqe3+WpVfHXslIn7KcBGh7ymotGaSHOYUTScwbSmIUKMVgPu3xLfN 0QSVdKP02XKT37P6NgOEwHhWspGH0BLLhshWqWWjswMUCEaAekShN6xAJ Tasn4aMo+5Qauv6e8R/LhWUan0WGf7Q8TZsgClFbcEsJ65/+QX/dQuzU9 RL39ymLNEewJ6yreGEdk9uZ+VRPpyOnGByL+SFq69dWVihs22lE7Vunpf 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230907_034644_664650_7FD4175E X-CRM114-Status: GOOD ( 12.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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-queue 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-e29820e8ff6d@axis.com --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- base-commit: 35494b0d61e44b517178aa1c6f5a69168b086940 change-id: 20230904-stmmac-coaloff-aca6befbd24b Best regards, diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/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) /* We still have pending packets, let's call for a new scheduling */ if (tx_q->dirty_tx != 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); flags = u64_stats_update_begin_irqsave(&tx_q->txq_stats.syncp); tx_q->txq_stats.tx_packets += 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 = &priv->dma_conf.tx_queue[queue]; + u32 tx_coal_timer = priv->tx_coal_timer[queue]; + + if (!tx_coal_timer) + return; hrtimer_start(&tx_q->txtimer, - STMMAC_COAL_TIMER(priv->tx_coal_timer[queue]), + STMMAC_COAL_TIMER(tx_coal_timer), HRTIMER_MODE_REL); }