From patchwork Mon Jan 13 11:45:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13937221 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 13469E7719E for ; Mon, 13 Jan 2025 11:48:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:Content-Type :Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=j2KOzFqn83lW4a3mHaCjytJhPLElKdN8kLiBUf4B0I4=; b=f5fDnzaiHMwL2BSZeRSaSGQpOj VjgnC+vvnwN3rM0cdP+TPMjmqtJ1VWEv+29vfXw5ChpjpLd1b748ri6p04rmxNFHQrxHvlTpgfM6T bUehq9FXsu0yx9sRgSyFh7yvmCDU4P++PzH3cG5V3O6ji+mj922jEhFPsEArf0u7FlTCrle8/JQnd TVai4vcbLRq9roX6W+GYfIOmwDV3bQ7E2Tuh21tGjqXKXeJxF2G7IbnWO6V0a6DHBNiCgOYl6SrI7 8IT3l2MXHI6F7st51dwFwy70DJEOmC3XeBa7RW4sRowRoY3SXVYHX5IGkD6jNKg/vlUzJems4A9rd GpLYHBlg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXIw0-00000004z8e-0VGl; Mon, 13 Jan 2025 11:48:44 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXItR-00000004ycR-3SJb for linux-arm-kernel@lists.infradead.org; Mon, 13 Jan 2025 11:46:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=j2KOzFqn83lW4a3mHaCjytJhPLElKdN8kLiBUf4B0I4=; b=RUHTTJZqJrk0CCmh22e+l3R+5s NB+oPZZlDpOwO2PqT6nUFUg1NP0YzZ2Vrjh8N6KUOHjsPSKdcOoGwpTP5uSunlZg6bEGCDJqtqGft KT0MgaOFNyUMAyhk2qOyYN+ZqDGpmWVBXNrxDKFUqZjhfJ0/EBTdMf6GNv/rN1HPLGZWUgUYyhwUv Ngel/p0VnzpRTFjNSPzaqFdBG13RXBoHjgwLD3m26mWFm8/tkC91FkeFbhAbOc1n7ecihxMEan0c4 sADt6THDOuO9LJIecu3RpTRcqt8B5f5sA3e0Pn9HbWbq9oN9OQkusUdbmqmIQOmK6U0GiUJWUGw1f i7PjfzjA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:49190 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tXItK-0006Uw-2a; Mon, 13 Jan 2025 11:45:58 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tXIt1-000MAu-TE; Mon, 13 Jan 2025 11:45:39 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Eric Woudstra , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexandre Torgue , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next 1/9] net: stmmac: rename stmmac_disable_sw_eee_mode() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 13 Jan 2025 11:45:39 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250113_034605_859866_51C81BE7 X-CRM114-Status: GOOD ( 11.87 ) 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 stmmac_disable_sw_eee_mode() was not a good choice for this functions purpose - which is to stop transmitting LPI because we want to send a packet. Rename it to stmmac_stop_sw_lpi(). Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 58b013528dea..8130b0f614d8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -427,12 +427,11 @@ static int stmmac_enable_eee_mode(struct stmmac_priv *priv) } /** - * stmmac_disable_sw_eee_mode - disable and exit from LPI mode + * stmmac_stop_sw_lpi - stop transmitting LPI * @priv: driver private structure - * Description: this function is to exit and disable EEE in case of - * LPI state is true. This is called by the xmit. + * Description: When using software-controlled LPI, stop transmitting LPI state. */ -static void stmmac_disable_sw_eee_mode(struct stmmac_priv *priv) +static void stmmac_stop_sw_lpi(struct stmmac_priv *priv) { stmmac_reset_eee_mode(priv, priv->hw); del_timer_sync(&priv->eee_ctrl_timer); @@ -4497,7 +4496,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) first_tx = tx_q->cur_tx; if (priv->tx_path_in_lpi_mode && priv->eee_sw_timer_en) - stmmac_disable_sw_eee_mode(priv); + stmmac_stop_sw_lpi(priv); /* Manage oversized TCP frames for GMAC4 device */ if (skb_is_gso(skb) && priv->tso) { From patchwork Mon Jan 13 11:45:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13937235 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 85BBFE7719E for ; Mon, 13 Jan 2025 11:50:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:Content-Type :Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=01Z6NUQGGVdbdysyHi9D4NLqyojbqR+9GRrkbvVdFFQ=; b=2IrdAGomaMX+Rg4zyyj6ustDVO TfMoFvPdc4halGu1+ovywwmLXNfirJjJ1SSBz4dbFoqb8RoHAJUEV3cLxE6PhOPtIU2AM67mmEKyO 0oBj+CELyl+rEl+ojlqgV0d8dbBDx4x5JT+J7ou9Z6jmd9a8Jr+YDz8yzK2SYwTxpNzwEX8gBlCnx x4M5Knosv7tufPBqqkFF58inRuiYyF2JaWVGRytUhdplq6A3+1jhYuyXzA9OMHVMI+Epm3RE+K/Hq h8yXRFpeBTWzbWXSIMgS0/pLDMx5Gg6ndKSAzLENcMRpJdtgVOBGXbsb/MswBUVFr6KlR6wgya+Lt HVhvV3Og==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXIxC-00000004zKr-3Y4r; Mon, 13 Jan 2025 11:49:58 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXItX-00000004ydS-1ik3 for linux-arm-kernel@lists.infradead.org; Mon, 13 Jan 2025 11:46:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=01Z6NUQGGVdbdysyHi9D4NLqyojbqR+9GRrkbvVdFFQ=; b=T+m+cyWomkZSFmtWRgo7licQxk NvfzfAJ1ovjuv71ka1EmpDj0ZlEI2HY1wnUj8pwBsXm1OVWhG0G7tGMjm2+e42kRtpfAgfDv67G6T XrxR/Y6xnjDwGaQWrQjg+KYrn3ED0Yq8R8IkF/NF0IPvUa8h9pdKJgYCpZTh6FlEaM7Xaog065Qpt WZvOMg8WiHAQ9m44puZksVWP7JPgKUdKiTp02rpyJk8EJ7oW/ZjvNO+6sL29nJXeOjlOp8Cecavo7 xhexAXMuynJWK10Gz0rawMrWG59AQAYzXm04QSOItIe9x4BRY1BnnHXzFC7PRSVC/tvllwSb5GCAy XldcMVoQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:48028 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tXItQ-0006V9-0L; Mon, 13 Jan 2025 11:46:04 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tXIt7-000MB0-0W; Mon, 13 Jan 2025 11:45:45 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Eric Woudstra , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexandre Torgue , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next 2/9] net: stmmac: correct priv->eee_sw_timer_en setting MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 13 Jan 2025 11:45:45 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250113_034611_447275_05FBB7EB X-CRM114-Status: GOOD ( 11.76 ) 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 If we are disabling EEE/LPI, then we should not be enabling software mode. The only time when we should is if EEE is active, and we are wanting to use software-timed EEE mode. Therefore, in the disable path of stmmac_eee_init(), ensure that priv->eee_sw_timer_en is set false as we are going to be calling del_timer_sync() on the timer. This will allow us to simplify some fast-path tests in later patches. Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 8130b0f614d8..f1e416b03349 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -478,7 +478,7 @@ static void stmmac_eee_init(struct stmmac_priv *priv, bool active) if (!priv->eee_active) { if (priv->eee_enabled) { netdev_dbg(priv->dev, "disable EEE\n"); - priv->eee_sw_timer_en = true; + priv->eee_sw_timer_en = false; stmmac_disable_hw_lpi_timer(priv); del_timer_sync(&priv->eee_ctrl_timer); stmmac_set_eee_timer(priv, priv->hw, 0, From patchwork Mon Jan 13 11:45:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13937236 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 B0234E7719E for ; Mon, 13 Jan 2025 11:51:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:Content-Type :Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=hOdrpZAmSqRk7KcSBI8gGwUZGDxOvGDd/H3Zqd4B98k=; b=PWzShlz+6SEd/gP9WX3a+sy0eD 4lm1ex3cyW4afe9IGBPzgbqcV/gnpLpgsbMHEg68ppUhcSp7JkCYo8jBSVZtVaBs4qdtjYszVuHeL o2Xm6mNX8nq/gKgirjKtDu/Q93RDsnFjQ6LIxYHb5X0Du6rex+MF7HhDWVJ7+iqCub1/FeT5nXq9p PXTjFU6Sp7wac9I9L3ewqqVMD8K6NsjpvBsoZAx3sC4T54Y+o+405DJk1BhGHRfouI0fMvCnZIH5X NX+W2ZBHehp5tL0QiN5+PctaDWdCsZg/ORtJH9Vu4cYFL7qAOyLLV3cG57qIqhknGQuF93EiE7ai+ AiAQR/Fw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXIyP-00000004zdS-2Bc6; Mon, 13 Jan 2025 11:51:13 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXItb-00000004yeX-3Qw3 for linux-arm-kernel@lists.infradead.org; Mon, 13 Jan 2025 11:46:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=hOdrpZAmSqRk7KcSBI8gGwUZGDxOvGDd/H3Zqd4B98k=; b=j00IdBCfKR/wGmZxAJzkeUg4bb CZ0lU6ZzRKt6fvWLNS+BdXQ3P9thS8ZKaGuGxqTc9G5gg0pb2o3gJ2vtGjYobsB+o2tq/RQ6offB/ 0z0XgeQwLFF9XPyPv/OblcLDH+T+ZUPC0TNLSOS6Z3NVV0yokCphg2MduP1C/6ieoWiKXrx2ORN4w ldD9jA+cHAY1mix6C3xOH5yUkqsTRN80a/cS9OCX/UnZT2c4WG8wD7Y91tPzH/VPhY25d/nz0g3cF XQjKDe/C69TChJhKZwWv1beMdzqB/sqma8cj9f1mrSoJGEbLe58E+zUQS6pWjNvF2cHEi8Y3qE0Pb eCGBzmgA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:48036 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tXItV-0006VQ-0K; Mon, 13 Jan 2025 11:46:09 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tXItC-000MB6-54; Mon, 13 Jan 2025 11:45:50 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Eric Woudstra , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexandre Torgue , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next 3/9] net: stmmac: simplify TX cleanup decision for ending sw LPI mode MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 13 Jan 2025 11:45:50 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250113_034615_853556_2315D78E X-CRM114-Status: GOOD ( 11.89 ) 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 As mentioned in "net: stmmac: correct priv->eee_sw_timer_en setting", we can simplify some fast-path tests. The transmit cleaning path checks whether EEE is enabled, the transmit path is not in LPI mode, and that we're using software timed mode. Since the above mentioned commit, checking whether EEE is enabled is no longer necessary as priv->eee_sw_timer_en will be false when EEE is disabled. Simplify this test. Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index f1e416b03349..e8667848e0ee 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2782,8 +2782,7 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue, xmits = budget; } - if (priv->eee_enabled && !priv->tx_path_in_lpi_mode && - priv->eee_sw_timer_en) { + if (priv->eee_sw_timer_en && !priv->tx_path_in_lpi_mode) { if (stmmac_enable_eee_mode(priv)) mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(priv->tx_lpi_timer)); } From patchwork Mon Jan 13 11:45:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13937237 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 A624EE7719E for ; Mon, 13 Jan 2025 11:52: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:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:Content-Type :Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=chXwxPSm499N84MeQ/hbX0oDsMrVYQ0eEiWb6Bzy+XA=; b=quiwRkzCV2/UhcHHwodjHDOUXw /2BuDBd9AHiBS5cXHs8suATDtvtP/K4qjJvDmu4sNd1rGetMntruAzcwd400cbca9CBq9z4R3Gcpj Sf7PdaRgKbQdFT+P36rzQ+W0vrWCi1DAw6UajHffJzELKsPsW9Eu3NHQooOEfHn8JsHrHFOmygSbp /QCLmnbCPdbBnKgpvpDWOsxs/odbCJ9Rio4mzJhrTcHxav1ltH9SazgSJS9On4r8WZBk0oW/LZwiK 7H3eoH1mE6AQQTDrG7MS5r+X4QvXo4GX8hVNriqJVlfnqcOi/irL+10Kdl5kfVwJvFGfLAaw451Y+ ZEycbC6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXIzc-00000004zsM-0VgD; Mon, 13 Jan 2025 11:52:28 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXIti-00000004ygZ-0GsP for linux-arm-kernel@lists.infradead.org; Mon, 13 Jan 2025 11:46:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=chXwxPSm499N84MeQ/hbX0oDsMrVYQ0eEiWb6Bzy+XA=; b=J57ZEuuJoJ9EkO5nhs+61xeyAh lrtQfofdDXMP1xze95c3uPiqKDHNQ2kPdIkx57CQABhEG72XQ9tsxJcF3150ZXG1T3ajtQC+LQCVK N7NYo76PjIr+UeC8uunP/67W4fAkYQWujWMxUrHXWRZv4IebagEQRThuTdxhCAY1uCeutbbgOIt8U eBZkVHlccjVxQi46R8m5lRE9kIUsDtETwsD964F5Sm+CrVSBX6QetO6QcRFJJRZa8798iakjvPijv IQskVvpgpGhaFxkPhn6jMzZh8DfiVuExRrsUiiO1pOKjuYwpTDCVHUZuCKvnJVQj1QuynNIutP1Bv pBOzySsA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:35688 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tXIta-0006Vg-18; Mon, 13 Jan 2025 11:46:14 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tXItH-000MBC-8i; Mon, 13 Jan 2025 11:45:55 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Eric Woudstra , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexandre Torgue , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next 4/9] net: stmmac: check priv->eee_sw_timer_en in suspend path MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 13 Jan 2025 11:45:55 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250113_034622_124964_E3AFF864 X-CRM114-Status: GOOD ( 11.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 The suspend path uses priv->eee_enabled when cleaning up the software timed LPI mode. Use priv->eee_sw_timer_en instead so we're consistently using a single control for software-based timer handling. Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index e8667848e0ee..26ff1ded4e3d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7719,7 +7719,7 @@ int stmmac_suspend(struct device *dev) for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer); - if (priv->eee_enabled) { + if (priv->eee_sw_timer_en) { priv->tx_path_in_lpi_mode = false; del_timer_sync(&priv->eee_ctrl_timer); } From patchwork Mon Jan 13 11:46:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13937238 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 6FDE0E7719F for ; Mon, 13 Jan 2025 11:53:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:Content-Type :Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eHGBpnOJSbQXIJIcFls+W2wBz5McA8yNE0ntaczE2hE=; b=ZZy9GgB7/BoBwnOHYJ1+ORpHVh S165mqdX15o/7EbCXQiJX0sW3ZAmc62cnugKFEkSYv4/fOOTCaeyuSMZ8Rvhfe1c1LZcbdfthstCc sPfM7HdagXp3nNu2dguyzWQt4F1FgsO0C8eHnQZjd68udbHAFuLrQFTSXMNv9JJ3gFVrs5mA6fcSr gAqyzbjaISUPIvNtL9B8fTms68O0j0QS1C+r/H+nYCjnbAWADReCl7DzsMww2u3AjshYg1X558ROj geebmmQ62wW2xLZ022I1qntjae60k5x1uokeIZn8zvvjj1zYg0B00onjmZHtiyJrK09a8MRhSNVe4 Bq3q00wg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXJ0o-000000050Fy-3EVa; Mon, 13 Jan 2025 11:53:42 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXItm-00000004yiO-1Sfg for linux-arm-kernel@lists.infradead.org; Mon, 13 Jan 2025 11:46:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=eHGBpnOJSbQXIJIcFls+W2wBz5McA8yNE0ntaczE2hE=; b=07IgX5hzLIa68QEHroPBGdGykk ylc62DhROu9kE3gMANoaYDxGIaU7Lm8Ffz6GSzTB1TjeMDowHqmiPFG/gVaKxzu+wF3BjC0nn9Qks L+hyXuq8L3k95XzNlCZE0j23Il+PClcGVKTIDmDzaOVYNJZkdPU/btLl2TphPtDrbBMAbMJXSyPqK vsdKhyd2ubop0qIlcejcA8k8cbmVaQsrhDLRxFQJX6CYEPzqxJnCb3EgSHgMUg8lIPHHx2KU+VmfJ QQtUrMj8Sl4QXQhPc4mkjACkpUX0UXbwByEHqfopxwNgjP4FZhxLXNCQmKAOljmEaCMv7BEEunLYu 9Dt05LNQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:35704 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tXItf-0006Vx-14; Mon, 13 Jan 2025 11:46:19 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tXItM-000MBI-CX; Mon, 13 Jan 2025 11:46:00 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Eric Woudstra , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexandre Torgue , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next 5/9] net: stmmac: add stmmac_try_to_start_sw_lpi() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 13 Jan 2025 11:46:00 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250113_034626_384029_74194145 X-CRM114-Status: GOOD ( 11.97 ) 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 are two places which call stmmac_enable_eee_mode() and follow it immediately by modifying the expiry of priv->eee_ctrl_timer. Both code paths are trying to enable LPI mode. Remove this duplication by providing a function for this. Signed-off-by: Russell King (Oracle) --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 26ff1ded4e3d..2bb61757e320 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -426,6 +426,13 @@ static int stmmac_enable_eee_mode(struct stmmac_priv *priv) return 0; } +static void stmmac_try_to_start_sw_lpi(struct stmmac_priv *priv) +{ + if (stmmac_enable_eee_mode(priv)) + mod_timer(&priv->eee_ctrl_timer, + STMMAC_LPI_T(priv->tx_lpi_timer)); +} + /** * stmmac_stop_sw_lpi - stop transmitting LPI * @priv: driver private structure @@ -449,8 +456,7 @@ static void stmmac_eee_ctrl_timer(struct timer_list *t) { struct stmmac_priv *priv = from_timer(priv, t, eee_ctrl_timer); - if (stmmac_enable_eee_mode(priv)) - mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(priv->tx_lpi_timer)); + stmmac_try_to_start_sw_lpi(priv); } /** @@ -2782,10 +2788,8 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue, xmits = budget; } - if (priv->eee_sw_timer_en && !priv->tx_path_in_lpi_mode) { - if (stmmac_enable_eee_mode(priv)) - mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(priv->tx_lpi_timer)); - } + if (priv->eee_sw_timer_en && !priv->tx_path_in_lpi_mode) + stmmac_try_to_start_sw_lpi(priv); /* We still have pending packets, let's call for a new scheduling */ if (tx_q->dirty_tx != tx_q->cur_tx) From patchwork Mon Jan 13 11:46:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13937239 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 B8FB5E7719F for ; Mon, 13 Jan 2025 11:55:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:Content-Type :Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=g+VsXR88odtwMSlVe7f6Y99n5yB+/8EudxncAOgJLec=; b=H20RZYGCZRkVFhFqqyGjkHBKWw vDIYftQVH8A/P3Kcq9Tnjc9IpndnicrStdje9vf7nd8SL8BqB0RLkn5n+39WdubLyTJRf05cBxb8y q1gAfB/kv2J/LWtbMx3x85N0Ojoqpz7WYCn988gDvuXYqwaAusRMFTh/O6+BhRnBhv826G/3ZliIR fSuvL1wc4EIttYDB1pwa4zLTlZmkXj26m1MP6Aii5q4+yJ/v3AfcxDA9cARducNnTV56bdjTbJwyh 9T2UkVoU5ObnhLCGTQkDDVkV8+GnIVSN8kQw2OF07q2ZAVMPtdOkslV+GcEX+t+mIESeMqZJ+yAR8 6PkA/A8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXJ21-000000050Qv-1oIh; Mon, 13 Jan 2025 11:54:57 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXItr-00000004yk0-1Rrj for linux-arm-kernel@lists.infradead.org; Mon, 13 Jan 2025 11:46:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=g+VsXR88odtwMSlVe7f6Y99n5yB+/8EudxncAOgJLec=; b=uaDiXOvuAhAd7fvqgtJPK3Pzym JAW2BZnk22M1VKV7SwEZ6cxmi5u/3PMN2R2W0KjhbZ/ljPtCkf4HgyVg0xpM1l+P+yNl4EwrW4xky +ttjAuCONpJey143HFrHBiazoXZAEWkELODOTbYoszY298Bw3vm5fb45teYwa+p7IavOGYgIH4Wja U87ONwH7CH8l7hYIlTPG3zK7hCCYt7fLfBRJbPG2qq6eCBZDu5/U61bE76wBxkHk2PHupTRtVnKjO CLz+BWNNrJjf/pQs0XfdkBs2toSBItyL3bI8xTuF+hiMTT6Gf+MKKRZiwKDe2KtQWz1wV2wXTUoEo MIfy/HJw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:45898 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tXItk-0006WI-1l; Mon, 13 Jan 2025 11:46:24 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tXItR-000MBO-GF; Mon, 13 Jan 2025 11:46:05 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Eric Woudstra , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexandre Torgue , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next 6/9] net: stmmac: provide stmmac_eee_tx_busy() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 13 Jan 2025 11:46:05 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250113_034631_386591_F0BC4D85 X-CRM114-Status: GOOD ( 12.40 ) 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 Extract the code which checks whether there's still work to do on any of the stmmac transmit queues. This will allow us to combine stmmac_enable_eee_mode() with stmmac_try_to_start_sw_lpi() in the next patch. Signed-off-by: Russell King (Oracle) --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 2bb61757e320..ddbcbe3886c0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -400,13 +400,7 @@ static void stmmac_enable_hw_lpi_timer(struct stmmac_priv *priv) stmmac_set_eee_lpi_timer(priv, priv->hw, priv->tx_lpi_timer); } -/** - * stmmac_enable_eee_mode - check and enter in LPI mode - * @priv: driver private structure - * Description: this function is to verify and enter in LPI mode in case of - * EEE. - */ -static int stmmac_enable_eee_mode(struct stmmac_priv *priv) +static bool stmmac_eee_tx_busy(struct stmmac_priv *priv) { u32 tx_cnt = priv->plat->tx_queues_to_use; u32 queue; @@ -416,9 +410,23 @@ static int stmmac_enable_eee_mode(struct stmmac_priv *priv) struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue]; if (tx_q->dirty_tx != tx_q->cur_tx) - return -EBUSY; /* still unfinished work */ + return true; /* still unfinished work */ } + return false; +} + +/** + * stmmac_enable_eee_mode - check and enter in LPI mode + * @priv: driver private structure + * Description: this function is to verify and enter in LPI mode in case of + * EEE. + */ +static int stmmac_enable_eee_mode(struct stmmac_priv *priv) +{ + if (stmmac_eee_tx_busy(priv)) + return -EBUSY; /* still unfinished work */ + /* Check and enter in LPI mode */ if (!priv->tx_path_in_lpi_mode) stmmac_set_eee_mode(priv, priv->hw, From patchwork Mon Jan 13 11:46:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13937240 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 69417E7719F for ; Mon, 13 Jan 2025 11:56:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:Content-Type :Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OlZYWPX0QNCSKKO5JWx1URTrYTNj5bjTeUg1yJzKm6g=; b=Bsg/qXhs+I3pNyBPH1xY9qOjKg QP7B7UuTVOTw/WgNP2/S6rOXMuaohufsh9taw1dpVXuRYnD/dgFHnLdPId7Y93YVnHuDIC999qvuf AnfqmEppXhr4+RI2rHvT1pb7FnCsyQnJuLDmeHqxGOPX/7nBXhE5Ja9/vgWE7eJX+hdHZRD+UBOcP OLKtMNBoV2CUDU73UDvlv9is+tGtiKfbevCMM2Te3k6geDwUJ2MTBKxRCDXI6BORtEbXQpxrFu9sw 1NReZYbfcTWeH3X0swDNxOg6dywkIVG/EPg5tu78RppPunEKnKJIHHLB87wX2gsKrEFZB3H7dzzVr Vg/b38Fw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXJ3D-000000050dO-0S7S; Mon, 13 Jan 2025 11:56:11 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXItx-00000004ymv-2qtb for linux-arm-kernel@lists.infradead.org; Mon, 13 Jan 2025 11:46:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=OlZYWPX0QNCSKKO5JWx1URTrYTNj5bjTeUg1yJzKm6g=; b=CEVqnTPusTw+aupRrYqlu84HHr /uDDsggTdYHG/CMitY1r+ceWHqYlZxEnITYNiOoqAhCbEbg8LuDndZA2x8+B74LGUlk0xjizBemZY 4MLhDG3qwEc/fn4P8fhTQEL5psw6fJsvJ3xYEJSm7ZoUqaUMBa2cVO4vPDBWEATKxqsPljsEjgAVb RAKjZqFXH7GpllEcahl4sbFKHZvhCZH3SgBNFfuzmVNWaD0lZBmaweN1ui4sj2ug2lSy3BAd/L8Q0 /T94hvXNLMlEKf5R0f9lq8rVBlt8IMk7IuR7XkaCvdH9uKB7207cUoIp/eadNipG0So3kunn+R54S sx0BhEeg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:45902 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tXItp-0006WZ-26; Mon, 13 Jan 2025 11:46:29 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tXItW-000MBU-KQ; Mon, 13 Jan 2025 11:46:10 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Eric Woudstra , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexandre Torgue , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next 7/9] net: stmmac: provide function for restarting sw LPI timer MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 13 Jan 2025 11:46:10 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250113_034637_716329_8545EBAC X-CRM114-Status: UNSURE ( 9.97 ) X-CRM114-Notice: Please train this message. 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 Provide a function that encapsulates restarting the software LPI timer when we have determined that the transmit path is busy, or whether the EEE parameters have changed. Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index ddbcbe3886c0..677a2172a85f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -416,6 +416,11 @@ static bool stmmac_eee_tx_busy(struct stmmac_priv *priv) return false; } +static void stmmac_restart_sw_lpi_timer(struct stmmac_priv *priv) +{ + mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(priv->tx_lpi_timer)); +} + /** * stmmac_enable_eee_mode - check and enter in LPI mode * @priv: driver private structure @@ -437,8 +442,7 @@ static int stmmac_enable_eee_mode(struct stmmac_priv *priv) static void stmmac_try_to_start_sw_lpi(struct stmmac_priv *priv) { if (stmmac_enable_eee_mode(priv)) - mod_timer(&priv->eee_ctrl_timer, - STMMAC_LPI_T(priv->tx_lpi_timer)); + stmmac_restart_sw_lpi_timer(priv); } /** @@ -526,8 +530,7 @@ static void stmmac_eee_init(struct stmmac_priv *priv, bool active) /* Use software LPI mode */ priv->eee_sw_timer_en = true; stmmac_disable_hw_lpi_timer(priv); - mod_timer(&priv->eee_ctrl_timer, - STMMAC_LPI_T(priv->tx_lpi_timer)); + stmmac_restart_sw_lpi_timer(priv); } priv->eee_enabled = true; From patchwork Mon Jan 13 11:46:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13937241 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 8E262E7719F for ; Mon, 13 Jan 2025 11:57:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:Content-Type :Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=GEgZ/SvmKDS++MiOXpGxNiPvw6lP1RjmRHXTj59mUno=; b=c9gRykUvwXo2Q6kbw9mo3bAW3H nJnuyInxJ0oCg+02wzNB08x0mitv+aJz06Zf5IZhXE/9jINEYGiMr8bzSE5jek1LBr8b1FkO2Y5in ixdn9HVyj9FDcR9PUWlyn2tG14gMsj5VGaikIdEEDwTnJWzVCxToSu4vWhDY3CChfObmAYVqFg7nb pVOf07/Lz3KwIF7xNeLU8W86M97sNRxsE7y2pHlX2OC47vbrdim8gDGwKmwLM/uFUya4T6yvTxUX1 F/KOGxhcedKj6Fb5Ff/SD2iclr8VpuzykTqF+9FeSUN5zJrdphfDWVJq4qeKljE0ZYU2rJSomRr2V eDRdrtiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXJ4P-000000050oE-2yzg; Mon, 13 Jan 2025 11:57:25 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXIu1-00000004yoP-1GIx for linux-arm-kernel@lists.infradead.org; Mon, 13 Jan 2025 11:46:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=GEgZ/SvmKDS++MiOXpGxNiPvw6lP1RjmRHXTj59mUno=; b=UzuOxMvTAtG53wSYLB9oUkGFls 0rdlR3mVUqQ5GeDjecci/PdH1Oe6/DtNZDKkXASsZRzNygPm42/To8o7qYkgSfdbtcx08lY25/ZrN hjfhQZJBLUGfRUelbeL5NL+bGjX6pmNXrUKU/9G6PJi4dMVgXdU8CPlnz/ImrwGVp04rZmxPafuw8 9SehgNL4lnFstOOuELO1LBX5s/1fbFyhTER+/1Ue7/7VB5if5o9Gvls1vCWu74/nh9yWsxk6QZtbb mLcvTRhxWgXXslab5EJObH47SZHpUGpI6lrKF2WQyGc5fyfTeDz16l56JG8ibY7LrB1lRKg8eKVq6 Csr5FThA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:38262 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tXItu-0006Wn-2f; Mon, 13 Jan 2025 11:46:34 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tXItb-000MBa-OU; Mon, 13 Jan 2025 11:46:15 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Eric Woudstra , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexandre Torgue , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next 8/9] net: stmmac: combine stmmac_enable_eee_mode() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 13 Jan 2025 11:46:15 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250113_034641_338637_ACB71A02 X-CRM114-Status: GOOD ( 16.35 ) 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 Combine stmmac_enable_eee_mode() with stmmac_try_to_start_sw_lpi() which makes the code easier to read and the flow more logical. We can now trivially see that if the transmit queues are busy, we (re-)start the eee_ctrl_timer. Otherwise, if the transmit path is not already in LPI mode, we ask the hardware to enter LPI mode. I believe that now we can see better what is going on here, this shows that there is a bug with the software LPI timer implementation. The LPI timer is supposed to define how long after the last transmittion completed before we start signalling LPI. However, this code structure shows that if all transmit queues are empty, and stmmac_try_to_start_sw_lpi() is called immediately after cleaning the transmit queue, we will instruct the hardware to start signalling LPI immediately. Signed-off-by: Russell King (Oracle) --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 677a2172a85f..72f270013086 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -422,27 +422,22 @@ static void stmmac_restart_sw_lpi_timer(struct stmmac_priv *priv) } /** - * stmmac_enable_eee_mode - check and enter in LPI mode + * stmmac_try_to_start_sw_lpi - check and enter in LPI mode * @priv: driver private structure * Description: this function is to verify and enter in LPI mode in case of * EEE. */ -static int stmmac_enable_eee_mode(struct stmmac_priv *priv) +static void stmmac_try_to_start_sw_lpi(struct stmmac_priv *priv) { - if (stmmac_eee_tx_busy(priv)) - return -EBUSY; /* still unfinished work */ + if (stmmac_eee_tx_busy(priv)) { + stmmac_restart_sw_lpi_timer(priv); + return; + } /* Check and enter in LPI mode */ if (!priv->tx_path_in_lpi_mode) stmmac_set_eee_mode(priv, priv->hw, priv->plat->flags & STMMAC_FLAG_EN_TX_LPI_CLOCKGATING); - return 0; -} - -static void stmmac_try_to_start_sw_lpi(struct stmmac_priv *priv) -{ - if (stmmac_enable_eee_mode(priv)) - stmmac_restart_sw_lpi_timer(priv); } /** From patchwork Mon Jan 13 11:46:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13937242 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 4B2C9E7719F for ; Mon, 13 Jan 2025 11:58:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:Content-Type :Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Icf5ryCIJcF20+mRtB38lPc5k3RjJWwfbRKAYFqi0WI=; b=kRajLUnYRH21sW2Vq4MiORxI/O kQrHLkbQjiijLFQFWCJRdJOvyiJJC/Sxs2XwCZBT8ctS6oK2bzv4vn2bC82WalKLxZ7XKAGL1FV/u UaB/C/vxWfseIM7HVnNztbXFlwt3Wi0me5ZeH1ZINM+I4682y9mT0KOrlfHd4VeZ2B+0te6HqBLsM loclxi2QDvcooj3FX+WHZ3wT/HMO59X7xRnpKK49SiArAW2ihOvT7hWQS6BR76Zhv9UnduFbM3Si5 OGFhlPCFTKuxW8wFkWCypHxcA0FabQU08st0xj2M96Koelqdq/2HfW6q029vP/zWHXuJEFe6/dMo6 ksVEorrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tXJ5b-000000050yi-1ZmG; Mon, 13 Jan 2025 11:58:39 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tXIu7-00000004ypi-0OPL for linux-arm-kernel@lists.infradead.org; Mon, 13 Jan 2025 11:46:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Icf5ryCIJcF20+mRtB38lPc5k3RjJWwfbRKAYFqi0WI=; b=CLIuNbxFGCKkV5AyGiPGpfX0qt CZ0/7NdHsZ09sRDrsLpbtoTyxVUD2jfzkZb+laaei7Iip6Rf+22dD1VE8/WKEaMicd3R0AsJkm9sG BMriQ5zO02Zd/6bWt+BK8b1LwCd1cGWFmZnpqnINQoKDmI+UlB1yurUmbJ6SpMohG1vSx7cIZRhMd FOdfSnFKSdILVaTtCTIQDeBdssaBaXxoI0tFL9XU+G4geaXQ3Lhy/N7I4IuvpovyTtXuL5pmb46FL P/sgHslnKCeWeoxzIB/HzZEaN38dX9f6jFo8eWrou8sHw6XxzTCziaoke/KPNYeFVP6T5xlkXd4tl XB33yW3Q==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:38268 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tXIu0-0006X5-02; Mon, 13 Jan 2025 11:46:40 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1tXItg-000MBg-TW; Mon, 13 Jan 2025 11:46:20 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Eric Woudstra , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexandre Torgue , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next 9/9] net: stmmac: restart LPI timer after cleaning transmit descriptors MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 13 Jan 2025 11:46:20 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250113_034647_126745_81A07E85 X-CRM114-Status: GOOD ( 12.44 ) 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 Fix a bug in the LPI handling, where it is possible to immediately enter LPI mode after cleaning the transmit descriptors when all queues are empty rather than waiting for the LPI timeout to expire. Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 72f270013086..acd6994c1764 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2795,7 +2795,7 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue, } if (priv->eee_sw_timer_en && !priv->tx_path_in_lpi_mode) - stmmac_try_to_start_sw_lpi(priv); + stmmac_restart_sw_lpi_timer(priv); /* We still have pending packets, let's call for a new scheduling */ if (tx_q->dirty_tx != tx_q->cur_tx)