linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Shenwei Wang <shenwei.wang@nxp.com>
To: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Jose Abreu <joabreu@synopsys.com>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	NXP Linux Team <linux-imx@nxp.com>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-stm32@st-md-mailman.stormreply.com, imx@lists.linux.dev,
	Shenwei Wang <shenwei.wang@nxp.com>,
	Mario Castaneda <mario.ignacio.castaneda.lopez@nxp.com>
Subject: [PATCH net] net: stmmac: dwmac-imx: request high frequency mode
Date: Wed,  4 Oct 2023 14:54:42 -0500	[thread overview]
Message-ID: <20231004195442.414766-1-shenwei.wang@nxp.com> (raw)

Some i.MX SoCs like the i.mx8mq support adjusting the frequency of the
DDR, AHB, and AXI buses based on system loading. If the dwmac interface
in the driver does not request a HIGH frequency, it can significantly
degrade performance when the system switches to a lower frequency to
conserve power.

For example, on an i.MX8MQ EVK board, the throughput dropped to around
100Mbit/s on a 1Gbit connection:

    [ ID] Interval           Transfer     Bitrate
    [  5]   0.00-10.00  sec   117 MBytes  97.9 Mbits/sec

However, throughput can return to expected levels after its driver requests
the high frequency mode. Requesting high frequency in the dwmac driver is
essential to maintain full throughput when the i.MX SoC adjusts bus speeds
for power savings.

Signed-off-by: Mario Castaneda <mario.ignacio.castaneda.lopez@nxp.com>
Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
Tested-by: Mario Castaneda <mario.ignacio.castaneda.lopez@nxp.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
index 8f730ada71f91..ba6ae0465ecaa 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
@@ -6,6 +6,7 @@
  *
  */
 
+#include <linux/busfreq-imx.h>
 #include <linux/clk.h>
 #include <linux/gpio/consumer.h>
 #include <linux/kernel.h>
@@ -152,7 +153,9 @@ static int imx_dwmac_clks_config(void *priv, bool enabled)
 			clk_disable_unprepare(dwmac->clk_mem);
 			return ret;
 		}
+		request_bus_freq(BUS_FREQ_HIGH);
 	} else {
+		release_bus_freq(BUS_FREQ_HIGH);
 		clk_disable_unprepare(dwmac->clk_tx);
 		clk_disable_unprepare(dwmac->clk_mem);
 	}
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2023-10-04 19:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-04 19:54 Shenwei Wang [this message]
2023-10-04 20:00 ` [PATCH net] net: stmmac: dwmac-imx: request high frequency mode Florian Fainelli
2023-10-04 20:16   ` Shenwei Wang
2023-10-04 21:59 ` Jakub Kicinski
2023-10-05  3:09 ` Andrew Lunn
2023-10-05  6:28 ` [Linux-stm32] " Ahmad Fatoum
2023-10-05 14:56   ` [EXT] " Shenwei Wang
2023-10-05 10:42 ` kernel test robot
2023-10-24 16:16 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231004195442.414766-1-shenwei.wang@nxp.com \
    --to=shenwei.wang@nxp.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=joabreu@synopsys.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mario.ignacio.castaneda.lopez@nxp.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).