From patchwork Fri Sep 22 11:12:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13395546 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 4F75ECD4F49 for ; Fri, 22 Sep 2023 11:13:41 +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:MIME-Version:Message-Id:Date:Subject:Cc :To: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=x1Dlg8nE93AY1wAR+U32Ln6mwtbAmsrGSac84dDSPLc=; b=xflDtF91i2OJeA N/al+cfw47WpIfzxI44CEv20KuYHlLC71es9lJfR7/Np0Xg61HaW4tXL9LK6ErPzNbP4af0D55V2y EDg0XQRDvLZ++UPwIcmQmbsgag8Tfu2OK+Efj82T9cJNOpzGdQ7YlhSBH4W3IBU6TLIAo0RvZrjit qpAU47XkgHxFd+4gbxZAvomdvm6ChDgeAT4f1u9Dy0sZyaWyOr7aMU/oOK50mL9JQmsAPCTTb1cRf MAA4yWlK0cz/5mY+FW85kMtmey8WGISGDsdqNswM9mdWMNfgEqFsQPyAOGD2DdwBmmUcmuZ0MeGjv O7iQjLXyHo6BMVz1aEVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qje5v-008vT6-27; Fri, 22 Sep 2023 11:13:11 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qje5s-008vSL-1L for linux-arm-kernel@lists.infradead.org; Fri, 22 Sep 2023 11:13:09 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-31dcf18f9e2so1917679f8f.0 for ; Fri, 22 Sep 2023 04:13:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695381186; x=1695985986; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Mo60L/CqsBXTZMp9OSNBO8agQpgsikCTWPBLj8xU0z8=; b=JvM8X+FR+6Eu9ieoBRSqG+C1FWk2SLeRdeBayZi0s9Mcolthuzvj3avWdfRlQJh8ur FnYMOOVIXzO4oqmookOpo7hWBgfZtuZl/96jHVfWcLonIJVcmH/ar4LU6ovHbyIsTxUf CEUC0o8qv83+EjA08XIZG/I0mN69m1RDvRVm883fzfleJ7SO4dyd+2pmz/4YUVBMAnGB Qd5ykcc+A8iHNj+Yaxy+qwIr6Ay/7x/ivyH70bhUPqOqjnDWia/11oy6+jhD+QEf6zBo 0FXWfAoVbArwo60lOjB8kumbxSQGv/CrumZtrWt0rUORTqMAPdkZH85RoOtX++L5QNpw mRYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695381186; x=1695985986; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Mo60L/CqsBXTZMp9OSNBO8agQpgsikCTWPBLj8xU0z8=; b=Kbe799ybhaa7pKUv5gjX6DQdnDTlmv6IB43hEPCnnmVw+WUaNFaCrGAhV6PyoPsvoM gWvqZEsT4rFD0sOoOi4fAre6t0Nza2NQczneNle0e9OycX5knwqA/5eEPK31G/PCK8E7 E2MVatrkwIVoWVx6fKBzaUSxtSJRU27G3s8HDLhJVRFcNL9cALfqTcpm7bk5PHFJ/8HZ uy3pjUFI9L2WmIJWVMBS/+o+WAUchv080LlkAFVcXUlbByjZs1mKtJJXgmkMvBC4u5nh 3fBbq3zjWhzXuwpL8HwkT20hX3IvPn8xx0yZtFPbH86qc0eQ5DL4LieAWGgru/0QpET2 OJZA== X-Gm-Message-State: AOJu0YyF+RpgKE+vCRcKGpAvPH0z75nO3SIXzq91kUNA4zfK/bTb3Ity D4Zdc5rxwapjfQ/R0cWvr1U= X-Google-Smtp-Source: AGHT+IH7mPXmlPp61fOS1UbXVt881rz7wfseEorF4MkXdznkIZPNZgazS5rBLuHv+qOU+uGgsaXdlQ== X-Received: by 2002:a5d:694d:0:b0:314:12c:4322 with SMTP id r13-20020a5d694d000000b00314012c4322mr7281735wrw.4.1695381185667; Fri, 22 Sep 2023 04:13:05 -0700 (PDT) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id g10-20020adffc8a000000b003176c6e87b1sm4191765wrr.81.2023.09.22.04.13.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 04:13:04 -0700 (PDT) From: Christian Marangi To: Vincent Whitchurch , Raju Rangoju , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Ping-Ke Shih , Kalle Valo , Simon Horman , Daniel Borkmann , Jiri Pirko , Hangbin Liu , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-wireless@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH 1/3] net: introduce napi_is_scheduled helper Date: Fri, 22 Sep 2023 13:12:45 +0200 Message-Id: <20230922111247.497-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230922_041308_478197_E53DECBD X-CRM114-Status: GOOD ( 17.75 ) 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 We currently have napi_if_scheduled_mark_missed that can be used to check if napi is scheduled but that does more thing than simply checking it and return a bool. Some driver already implement custom function to check if napi is scheduled. Drop these custom function and introduce napi_is_scheduled that simply check if napi is scheduled atomically. Update any driver and code that implement a similar check and instead use this new helper. Signed-off-by: Christian Marangi Reviewed-by: Amritha Nambiar --- drivers/net/ethernet/chelsio/cxgb3/sge.c | 8 -------- drivers/net/wireless/realtek/rtw89/core.c | 2 +- include/linux/netdevice.h | 5 +++++ net/core/dev.c | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb3/sge.c b/drivers/net/ethernet/chelsio/cxgb3/sge.c index 2e9a74fe0970..71fa2dc19034 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c @@ -2501,14 +2501,6 @@ static int napi_rx_handler(struct napi_struct *napi, int budget) return work_done; } -/* - * Returns true if the device is already scheduled for polling. - */ -static inline int napi_is_scheduled(struct napi_struct *napi) -{ - return test_bit(NAPI_STATE_SCHED, &napi->state); -} - /** * process_pure_responses - process pure responses from a response queue * @adap: the adapter diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c index 133bf289bacb..bbf4ea3639d4 100644 --- a/drivers/net/wireless/realtek/rtw89/core.c +++ b/drivers/net/wireless/realtek/rtw89/core.c @@ -1744,7 +1744,7 @@ static void rtw89_core_rx_to_mac80211(struct rtw89_dev *rtwdev, struct napi_struct *napi = &rtwdev->napi; /* In low power mode, napi isn't scheduled. Receive it to netif. */ - if (unlikely(!test_bit(NAPI_STATE_SCHED, &napi->state))) + if (unlikely(!napi_is_scheduled(napi))) napi = NULL; rtw89_core_hw_to_sband_rate(rx_status); diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index db3d8429d50d..8eac00cd3b92 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -482,6 +482,11 @@ static inline bool napi_prefer_busy_poll(struct napi_struct *n) return test_bit(NAPI_STATE_PREFER_BUSY_POLL, &n->state); } +static inline bool napi_is_scheduled(struct napi_struct *n) +{ + return test_bit(NAPI_STATE_SCHED, &n->state); +} + bool napi_schedule_prep(struct napi_struct *n); /** diff --git a/net/core/dev.c b/net/core/dev.c index cc03a5758d2d..32ba8002f65a 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -6523,7 +6523,7 @@ static int __napi_poll(struct napi_struct *n, bool *repoll) * accidentally calling ->poll() when NAPI is not scheduled. */ work = 0; - if (test_bit(NAPI_STATE_SCHED, &n->state)) { + if (napi_is_scheduled(n)) { work = n->poll(n, weight); trace_napi_poll(n, work, weight); } From patchwork Fri Sep 22 11:12:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13395547 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 22F65CD4F57 for ; Fri, 22 Sep 2023 11:13:46 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DMcCNHSSKL3I2VjDLZEQaocHEulX5AJrCZmxJyl47NI=; b=UEhs6kEO5TPa4C Ri8bk4xRzUEaBnMk5ADjYk0QbWQbptnuurHpJIFmy4T29vjLJ2qELNazYk/xPhb7mxCrK3LBkm88J dISYvJ3I9imEco8h3TvwJAtkiLul6ipYrULb6SY+aIHE+c5fL6xPsybXgxd+jDe4WHVGSNuNM3zTB 5x50nKnb1rjiSPIh9AoX859EZPG9D+zQ3uol/rj9//m6SuQI5U/ZAfbnsmL2JbYoU0teYl2je7LHt oiC7TYVr42mM6Oq3B5fIAbZ7RJVG+3sP4g5EVvxHxWsDPin92sNqxOAQQ3iO75KzyXYZ8vrKhsqoq PqnHdZ49cF7Q1bMD2WDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qje62-008vUu-1G; Fri, 22 Sep 2023 11:13:18 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qje5u-008vSQ-0S for linux-arm-kernel@lists.infradead.org; Fri, 22 Sep 2023 11:13:11 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-32172a50356so1935018f8f.0 for ; Fri, 22 Sep 2023 04:13:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695381187; x=1695985987; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NO4PPCAYeBqa8N3X8iNMzO62NO9a8Aa1IWA9xi7rYvw=; b=Ow01nf2B2T1vDQSeX0Zc284H16polOafdDjnddefShFpdceNPoFPxwWx8KchKD/jKM FSjbH+LqnN1xa8uXCeZRE70uUYeIuWcNdJqzzuJM+rneVNG3y5PzBQ9IBGrs1oZI5diw ttz4Q/sEfKJhK3F2lfpHhKC2Bx7olCUxSnUWq+QDHejJZxBiB9wDn+/IlbpEDitiaIZv uU7iQBNBY7JGI+liBeADmjOSWA9wpIvVW5XdczwZ0urg6YLEKxqEsNCNwCdrR28aFfBG IN+HoF6JMdJv67h3zJP/z7s+ekiXjWoJja58DWkKeUbgKidbuy8zzIfUSvcVgqXucWOv 89dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695381187; x=1695985987; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NO4PPCAYeBqa8N3X8iNMzO62NO9a8Aa1IWA9xi7rYvw=; b=JUtonMJPIKUlNCYdGr+G/vHXSDx5ESAelUAtnfLxHRYNKh+kLjIj6iRvRdk57LHiqh EcbCyguJsqfJXhk+zTxUJjzv7v02FiD2qY6jgSuxkW3RW47wWopo8hq3tPLZspRjaWVz O8LkfCJ/kL0KEQX2Kx2q0nEeziu8kSJJt+AVpF2Bj+aTod4WSlDpRu7NJBqmQgQAMFyh /N1Z5z03KAhmGxvyZOawvRyAxh7MrG/0jmx+1HED8eppevdAQRJewaQjVZ43u9tqiS/7 qCOCkvZTqFIOhLfxXGPgKGyb+qelW3VBBXUFcl2YL1UlxlQBCOtpUWueIMOSTlQvjl0J mcBg== X-Gm-Message-State: AOJu0Yw80K/v0IhvlaOphyVB7GI0sBKCpKWMeiaCv27ijDsXjYR9z7z6 9TxMUHF7sYYFH7VIG0Of54Y= X-Google-Smtp-Source: AGHT+IGt2zxWyI/cHaEIM9YNy0bqvfBVCcm7j3twnx0VeOiWaEz6/6Yr9n/oPYq1bGBQ0w34CKjfgA== X-Received: by 2002:adf:fbcf:0:b0:31f:d8b3:e9f5 with SMTP id d15-20020adffbcf000000b0031fd8b3e9f5mr6831681wrs.34.1695381186972; Fri, 22 Sep 2023 04:13:06 -0700 (PDT) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id g10-20020adffc8a000000b003176c6e87b1sm4191765wrr.81.2023.09.22.04.13.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 04:13:06 -0700 (PDT) From: Christian Marangi To: Vincent Whitchurch , Raju Rangoju , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Ping-Ke Shih , Kalle Valo , Simon Horman , Daniel Borkmann , Jiri Pirko , Hangbin Liu , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-wireless@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH 2/3] net: stmmac: improve TX timer arm logic Date: Fri, 22 Sep 2023 13:12:46 +0200 Message-Id: <20230922111247.497-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230922111247.497-1-ansuelsmth@gmail.com> References: <20230922111247.497-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230922_041310_177949_63748B32 X-CRM114-Status: GOOD ( 21.56 ) 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 There is currently a problem with the TX timer getting armed multiple unnecessary times causing big performance regression on some device that suffer from heavy handling of hrtimer rearm. The use of the TX timer is an old implementation that predates the napi implementation and the interrupt enable/disable handling. Due to stmmac being a very old code, the TX timer was never evaluated again with this new implementation and was kept there causing performance regression. The performance regression started to appear with kernel version 4.19 with 8fce33317023 ("net: stmmac: Rework coalesce timer and fix multi-queue races") where the timer was reduced to 1ms causing it to be armed 40 times more than before. Decreasing the timer made the problem more present and caused the regression in the other of 600-700mbps on some device (regression where this was notice is ipq806x). The problem is in the fact that handling the hrtimer on some target is expensive and recent kernel made the timer armed much more times. A solution that was proposed was reverting the hrtimer change and use mod_timer but such solution would still hide the real problem in the current implementation. To fix the regression, apply some additional logic and skip arming the timer when not needed. Arm the timer ONLY if a napi is not already scheduled. Running the timer is redundant since the same function (stmmac_tx_clean) will run in the napi TX poll. Also try to cancel any timer if a napi is scheduled to prevent redundant run of TX call. With the following new logic the original performance are restored while keeping using the hrtimer. Signed-off-by: Christian Marangi --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 9201ed778ebc..14bf6fae6662 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2994,13 +2994,25 @@ 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]; + struct stmmac_channel *ch; + struct napi_struct *napi; if (!tx_coal_timer) return; - hrtimer_start(&tx_q->txtimer, - STMMAC_COAL_TIMER(tx_coal_timer), - HRTIMER_MODE_REL); + ch = &priv->channel[tx_q->queue_index]; + napi = tx_q->xsk_pool ? &ch->rxtx_napi : &ch->tx_napi; + + /* Arm timer only if napi is not already scheduled. + * Try to cancel any timer if napi is scheduled, timer will be armed + * again in the next scheduled napi. + */ + if (unlikely(!napi_is_scheduled(napi))) + hrtimer_start(&tx_q->txtimer, + STMMAC_COAL_TIMER(tx_coal_timer), + HRTIMER_MODE_REL); + else + hrtimer_try_to_cancel(&tx_q->txtimer); } /** From patchwork Fri Sep 22 11:12:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13395545 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 ED1D5CD4F57 for ; Fri, 22 Sep 2023 11:13:39 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=I8eq4B5XDeLjtgbrnWOmuKGChHplwGfOIdKu38OSjXk=; b=3k29qQP8BJW5rX fJXFSmhxHavA0diagm+4ZHQq9svUUmb2zxxy+eOsiYJjdjI21Cc6/QaGo0CVyzxydZPUqYv+iHzfc JzvclenSPo4JzcpdtIvLfb5dTHZiCTSQdtc9THM+MYEdN2md4BZGjZEKHqZ5pdpGm4+YpvkJBfmhf xjE3HWE9ummp/Ck13Dbk+s9L5PczjN7YIgwu2vNbclIa6yAvnTW9pCLsRQvlMklrVqKkU/b96ApJP Yf+N2AUIR8duHBLnXCUDxMKFsQVoyJYGXCKs2oa8Y9ExTWKiu6HkhmHx6H4xck17usB66odQEMScc Ffe6b79UAxhkw++7pfHg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qje62-008vVE-2z; Fri, 22 Sep 2023 11:13:18 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qje5v-008vSf-1o for linux-arm-kernel@lists.infradead.org; Fri, 22 Sep 2023 11:13:12 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4053db20d03so6060515e9.2 for ; Fri, 22 Sep 2023 04:13:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695381189; x=1695985989; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/ijlwZ6JRdK1U0SnHerxGcEJGjK9VRf4PRp/VeOrzMQ=; b=ECSqQ+EUXQf1UM5rObq6y8QdBG56d/6JbvGrYIuqlvpBXPSB3hdO12VF8VpobVR/rt 39U4f4BMAEC3qiO2mOXI9S7/tZ/jmu6WkLITABYE43S4xfOEt6A0941KUNPE+WX2oyHf p3SgEWq0novXg4vgX6HGGz1NXm65aM4AMvfB/jXOIWZduOi9HDHcPrQXwZcqwCzkkG9z k/2hOLeeN45gSlRBXtk74Fs3VGp6cwnPcDpZQMbJOqAbLfV/pPWSSbd3b7UjJI9AgikC sLG/cYkZhK/ULY+d6kltlFFxRRWEQ9h8Go3ESkHCmkqx13qgpNjnrmTLwtbnvJCnc1K4 3djA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695381189; x=1695985989; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/ijlwZ6JRdK1U0SnHerxGcEJGjK9VRf4PRp/VeOrzMQ=; b=VlCeP6+8bpDIi+VmIwYtF1dbsOkxmVOIgao5QIsjCEWcmt1sJ9AZOcRNij0gOYNgZn DTqIQUI1EnmxiqrPVRHg1kgtJYlgxv8akYdxNzGIvb3qexA1f6pQivyYWup+NngYnSBs v/6xpKEXycYwDrHIZv6PkNFcV6L2XaHeM+ThZHsFsu2uDx149MD/MmlfQbF/zNbWFjoA dmb4/Li2/hZNjc8zktOm82QccHYAjOcJnFwKdOtz4iNaz/KBMWAYT4Dgj5POF4HOJ9aR 1+kNxu5UaZiNzfCy0Kw62cs4OXNVnmyNX348MPvKgbMb19EXcQhvUYa5CuXOKy10KoVn uLaA== X-Gm-Message-State: AOJu0YyNyejv4Fktro00xE04dUvb7/hMSbgRHDhXhMmoEgpKzCKQdLg0 93jpQrADel4QfrOnKTmTiOI= X-Google-Smtp-Source: AGHT+IHTzusDD1Vj12nFTAofcTh5ujgUoGMSUjxYvnBVt5FrCDDmYAOQS2TIjfWAp8W6AwxsKaiBCA== X-Received: by 2002:a05:600c:152:b0:403:cc64:2dbf with SMTP id w18-20020a05600c015200b00403cc642dbfmr7548257wmm.27.1695381188563; Fri, 22 Sep 2023 04:13:08 -0700 (PDT) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id g10-20020adffc8a000000b003176c6e87b1sm4191765wrr.81.2023.09.22.04.13.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 04:13:07 -0700 (PDT) From: Christian Marangi To: Vincent Whitchurch , Raju Rangoju , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Ping-Ke Shih , Kalle Valo , Simon Horman , Daniel Borkmann , Jiri Pirko , Hangbin Liu , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-wireless@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH 3/3] net: stmmac: increase TX coalesce timer to 5ms Date: Fri, 22 Sep 2023 13:12:47 +0200 Message-Id: <20230922111247.497-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230922111247.497-1-ansuelsmth@gmail.com> References: <20230922111247.497-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230922_041311_598885_F42F1C59 X-CRM114-Status: GOOD ( 14.68 ) 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 Commit 8fce33317023 ("net: stmmac: Rework coalesce timer and fix multi-queue races") decreased the TX coalesce timer from 40ms to 1ms. This caused some performance regression on some target (regression was reported at least on ipq806x) in the order of 600mbps dropping from gigabit handling to only 200mbps. The problem was identified in the TX timer getting armed too much time. While this was fixed and improved in another commit, performance can be improved even further by increasing the timer delay a bit moving from 1ms to 5ms. The value is a good balance between battery saving by prevending too much interrupt to be generated and permitting good performance for internet oriented devices. Signed-off-by: Christian Marangi --- drivers/net/ethernet/stmicro/stmmac/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h index 403cb397d4d3..2d9f895c2193 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h @@ -290,7 +290,7 @@ struct stmmac_safety_stats { #define MIN_DMA_RIWT 0x10 #define DEF_DMA_RIWT 0xa0 /* Tx coalesce parameters */ -#define STMMAC_COAL_TX_TIMER 1000 +#define STMMAC_COAL_TX_TIMER 5000 #define STMMAC_MAX_COAL_TX_TICK 100000 #define STMMAC_TX_MAX_FRAMES 256 #define STMMAC_TX_FRAMES 25