2023-08-21 05:41:37 +00:00
|
|
|
From 0db3e9ac75b107d2158b227426f58df9bb00529f Mon Sep 17 00:00:00 2001
|
|
|
|
From: Oskari Lemmela <oskari@lemmela.net>
|
|
|
|
Date: Sun, 20 Aug 2023 15:25:09 +0300
|
|
|
|
Subject: [PATCH] Revert "net: stmmac: Use hrtimer for TX coalescing"
|
|
|
|
|
|
|
|
This reverts commit d5a05e69ac6e4c431c380ced2b534c91f7bc3280.
|
|
|
|
|
|
|
|
hrtimer uses raw_spin_lock which causes high CPU usage.
|
|
|
|
ipq806x platform's TCP transmit speed dropped from 950 Mbps to 250 Mbps
|
|
|
|
due to high ksoftirq.
|
|
|
|
|
|
|
|
Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
|
|
|
|
---
|
|
|
|
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 3 +--
|
|
|
|
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 25 +++++++------------
|
|
|
|
2 files changed, 10 insertions(+), 18 deletions(-)
|
|
|
|
|
|
|
|
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
|
|
|
|
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
|
|
|
|
@@ -13,7 +13,6 @@
|
|
|
|
#define DRV_MODULE_VERSION "Jan_2016"
|
|
|
|
|
|
|
|
#include <linux/clk.h>
|
|
|
|
-#include <linux/hrtimer.h>
|
|
|
|
#include <linux/if_vlan.h>
|
|
|
|
#include <linux/stmmac.h>
|
|
|
|
#include <linux/phylink.h>
|
|
|
|
@@ -59,7 +58,7 @@ struct stmmac_tx_info {
|
|
|
|
struct stmmac_tx_queue {
|
|
|
|
u32 tx_count_frames;
|
|
|
|
int tbs;
|
|
|
|
- struct hrtimer txtimer;
|
|
|
|
+ struct timer_list txtimer;
|
|
|
|
u32 queue_index;
|
|
|
|
struct stmmac_priv *priv_data;
|
|
|
|
struct dma_extended_desc *dma_etx ____cacheline_aligned_in_smp;
|
|
|
|
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
|
|
|
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
|
|
|
@@ -142,7 +142,7 @@ static void stmmac_init_fs(struct net_de
|
|
|
|
static void stmmac_exit_fs(struct net_device *dev);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
-#define STMMAC_COAL_TIMER(x) (ns_to_ktime((x) * NSEC_PER_USEC))
|
|
|
|
+#define STMMAC_COAL_TIMER(x) (jiffies + usecs_to_jiffies(x))
|
|
|
|
|
|
|
|
int stmmac_bus_clks_config(struct stmmac_priv *priv, bool enabled)
|
|
|
|
{
|
kernel: bump 5.15 to 5.15.145
Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.145
No patches needed a rebase.
23.05 backport:
Rebased patch mediatek/100-dts-update-mt7622-rfb1.patch due to
changes introduced in commit e37aa926447f ("arm64: dts: mediatek:
mt7622: fix memory node warning check") in version v5.15.143 and we
jumped over from v5.15.139 directly to v5.15.145.
Build system: x86_64
Build-tested: ramips/tplink_archer-a6-v3
Run-tested: ramips/tplink_archer-a6-v3
23.05 backport:
Stijn:
Compile-tested: ath79/generic, ipq40xx/generic, mvebu/cortexa72, ramips/mt{7621,7620,76x8}, realtek/rtl{838x,930x}, 86/64.
Run-tested: cortexa72 (RB5009UG+S+IN), mt7621 (EAP615-Wall v1), rtl838x (GS1900-10HP, GS1900-8HP, GS108T v3).
Petr:
Compile-tested: ipq807x, mvebu/cortexa9
Run-tested: turris-omnia, prpl-haze
Tested-by: Stijn Segers <foss@volatilesystems.org> [23.05 testing]
Signed-off-by: John Audia <therealgraysky@proton.me>
Signed-off-by: Petr Štetiar <ynezz@true.cz> [23.05 refresh]
(cherry picked from commit 8de4cc77a6d5c25e48566d0203f159287ac7f3fe)
2023-12-23 11:52:06 +00:00
|
|
|
@@ -2726,9 +2726,7 @@ static int stmmac_tx_clean(struct stmmac
|
2023-08-21 05:41:37 +00:00
|
|
|
|
|
|
|
/* 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);
|
|
|
|
+ mod_timer(&tx_q->txtimer, STMMAC_COAL_TIMER(priv->tx_coal_timer[queue]));
|
|
|
|
|
|
|
|
__netif_tx_unlock_bh(netdev_get_tx_queue(priv->dev, queue));
|
|
|
|
|
kernel: bump 5.15 to 5.15.145
Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.145
No patches needed a rebase.
23.05 backport:
Rebased patch mediatek/100-dts-update-mt7622-rfb1.patch due to
changes introduced in commit e37aa926447f ("arm64: dts: mediatek:
mt7622: fix memory node warning check") in version v5.15.143 and we
jumped over from v5.15.139 directly to v5.15.145.
Build system: x86_64
Build-tested: ramips/tplink_archer-a6-v3
Run-tested: ramips/tplink_archer-a6-v3
23.05 backport:
Stijn:
Compile-tested: ath79/generic, ipq40xx/generic, mvebu/cortexa72, ramips/mt{7621,7620,76x8}, realtek/rtl{838x,930x}, 86/64.
Run-tested: cortexa72 (RB5009UG+S+IN), mt7621 (EAP615-Wall v1), rtl838x (GS1900-10HP, GS1900-8HP, GS108T v3).
Petr:
Compile-tested: ipq807x, mvebu/cortexa9
Run-tested: turris-omnia, prpl-haze
Tested-by: Stijn Segers <foss@volatilesystems.org> [23.05 testing]
Signed-off-by: John Audia <therealgraysky@proton.me>
Signed-off-by: Petr Štetiar <ynezz@true.cz> [23.05 refresh]
(cherry picked from commit 8de4cc77a6d5c25e48566d0203f159287ac7f3fe)
2023-12-23 11:52:06 +00:00
|
|
|
@@ -3020,9 +3018,7 @@ static void stmmac_tx_timer_arm(struct s
|
2023-08-21 05:41:37 +00:00
|
|
|
{
|
|
|
|
struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
|
|
|
|
|
|
|
|
- hrtimer_start(&tx_q->txtimer,
|
|
|
|
- STMMAC_COAL_TIMER(priv->tx_coal_timer[queue]),
|
|
|
|
- HRTIMER_MODE_REL);
|
|
|
|
+ mod_timer(&tx_q->txtimer, STMMAC_COAL_TIMER(priv->tx_coal_timer[queue]));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
kernel: bump 5.15 to 5.15.145
Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.145
No patches needed a rebase.
23.05 backport:
Rebased patch mediatek/100-dts-update-mt7622-rfb1.patch due to
changes introduced in commit e37aa926447f ("arm64: dts: mediatek:
mt7622: fix memory node warning check") in version v5.15.143 and we
jumped over from v5.15.139 directly to v5.15.145.
Build system: x86_64
Build-tested: ramips/tplink_archer-a6-v3
Run-tested: ramips/tplink_archer-a6-v3
23.05 backport:
Stijn:
Compile-tested: ath79/generic, ipq40xx/generic, mvebu/cortexa72, ramips/mt{7621,7620,76x8}, realtek/rtl{838x,930x}, 86/64.
Run-tested: cortexa72 (RB5009UG+S+IN), mt7621 (EAP615-Wall v1), rtl838x (GS1900-10HP, GS1900-8HP, GS108T v3).
Petr:
Compile-tested: ipq807x, mvebu/cortexa9
Run-tested: turris-omnia, prpl-haze
Tested-by: Stijn Segers <foss@volatilesystems.org> [23.05 testing]
Signed-off-by: John Audia <therealgraysky@proton.me>
Signed-off-by: Petr Štetiar <ynezz@true.cz> [23.05 refresh]
(cherry picked from commit 8de4cc77a6d5c25e48566d0203f159287ac7f3fe)
2023-12-23 11:52:06 +00:00
|
|
|
@@ -3031,9 +3027,9 @@ static void stmmac_tx_timer_arm(struct s
|
2023-08-21 05:41:37 +00:00
|
|
|
* Description:
|
|
|
|
* This is the timer handler to directly invoke the stmmac_tx_clean.
|
|
|
|
*/
|
|
|
|
-static enum hrtimer_restart stmmac_tx_timer(struct hrtimer *t)
|
|
|
|
+static void stmmac_tx_timer(struct timer_list *t)
|
|
|
|
{
|
|
|
|
- struct stmmac_tx_queue *tx_q = container_of(t, struct stmmac_tx_queue, txtimer);
|
|
|
|
+ struct stmmac_tx_queue *tx_q = from_timer(tx_q, t, txtimer);
|
|
|
|
struct stmmac_priv *priv = tx_q->priv_data;
|
|
|
|
struct stmmac_channel *ch;
|
|
|
|
struct napi_struct *napi;
|
kernel: bump 5.15 to 5.15.145
Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.145
No patches needed a rebase.
23.05 backport:
Rebased patch mediatek/100-dts-update-mt7622-rfb1.patch due to
changes introduced in commit e37aa926447f ("arm64: dts: mediatek:
mt7622: fix memory node warning check") in version v5.15.143 and we
jumped over from v5.15.139 directly to v5.15.145.
Build system: x86_64
Build-tested: ramips/tplink_archer-a6-v3
Run-tested: ramips/tplink_archer-a6-v3
23.05 backport:
Stijn:
Compile-tested: ath79/generic, ipq40xx/generic, mvebu/cortexa72, ramips/mt{7621,7620,76x8}, realtek/rtl{838x,930x}, 86/64.
Run-tested: cortexa72 (RB5009UG+S+IN), mt7621 (EAP615-Wall v1), rtl838x (GS1900-10HP, GS1900-8HP, GS108T v3).
Petr:
Compile-tested: ipq807x, mvebu/cortexa9
Run-tested: turris-omnia, prpl-haze
Tested-by: Stijn Segers <foss@volatilesystems.org> [23.05 testing]
Signed-off-by: John Audia <therealgraysky@proton.me>
Signed-off-by: Petr Štetiar <ynezz@true.cz> [23.05 refresh]
(cherry picked from commit 8de4cc77a6d5c25e48566d0203f159287ac7f3fe)
2023-12-23 11:52:06 +00:00
|
|
|
@@ -3049,8 +3045,6 @@ static enum hrtimer_restart stmmac_tx_ti
|
2023-08-21 05:41:37 +00:00
|
|
|
spin_unlock_irqrestore(&ch->lock, flags);
|
|
|
|
__napi_schedule(napi);
|
|
|
|
}
|
|
|
|
-
|
|
|
|
- return HRTIMER_NORESTART;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
kernel: bump 5.15 to 5.15.145
Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.145
No patches needed a rebase.
23.05 backport:
Rebased patch mediatek/100-dts-update-mt7622-rfb1.patch due to
changes introduced in commit e37aa926447f ("arm64: dts: mediatek:
mt7622: fix memory node warning check") in version v5.15.143 and we
jumped over from v5.15.139 directly to v5.15.145.
Build system: x86_64
Build-tested: ramips/tplink_archer-a6-v3
Run-tested: ramips/tplink_archer-a6-v3
23.05 backport:
Stijn:
Compile-tested: ath79/generic, ipq40xx/generic, mvebu/cortexa72, ramips/mt{7621,7620,76x8}, realtek/rtl{838x,930x}, 86/64.
Run-tested: cortexa72 (RB5009UG+S+IN), mt7621 (EAP615-Wall v1), rtl838x (GS1900-10HP, GS1900-8HP, GS108T v3).
Petr:
Compile-tested: ipq807x, mvebu/cortexa9
Run-tested: turris-omnia, prpl-haze
Tested-by: Stijn Segers <foss@volatilesystems.org> [23.05 testing]
Signed-off-by: John Audia <therealgraysky@proton.me>
Signed-off-by: Petr Štetiar <ynezz@true.cz> [23.05 refresh]
(cherry picked from commit 8de4cc77a6d5c25e48566d0203f159287ac7f3fe)
2023-12-23 11:52:06 +00:00
|
|
|
@@ -3073,8 +3067,7 @@ static void stmmac_init_coalesce(struct
|
2023-08-21 05:41:37 +00:00
|
|
|
priv->tx_coal_frames[chan] = STMMAC_TX_FRAMES;
|
|
|
|
priv->tx_coal_timer[chan] = STMMAC_COAL_TX_TIMER;
|
|
|
|
|
|
|
|
- hrtimer_init(&tx_q->txtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
|
|
|
|
- tx_q->txtimer.function = stmmac_tx_timer;
|
|
|
|
+ timer_setup(&tx_q->txtimer, stmmac_tx_timer, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (chan = 0; chan < rx_channel_count; chan++)
|
2024-01-26 21:55:30 +00:00
|
|
|
@@ -3904,7 +3897,7 @@ irq_error:
|
2023-08-21 05:41:37 +00:00
|
|
|
phylink_stop(priv->phylink);
|
|
|
|
|
|
|
|
for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
|
|
|
|
- hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer);
|
|
|
|
+ del_timer_sync(&priv->dma_conf.tx_queue[chan].txtimer);
|
|
|
|
|
|
|
|
stmmac_hw_teardown(dev);
|
|
|
|
init_error:
|
2024-01-26 21:55:30 +00:00
|
|
|
@@ -3960,7 +3953,7 @@ static int stmmac_release(struct net_dev
|
2023-08-21 05:41:37 +00:00
|
|
|
stmmac_disable_all_queues(priv);
|
|
|
|
|
|
|
|
for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
|
|
|
|
- hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer);
|
|
|
|
+ del_timer_sync(&priv->dma_conf.tx_queue[chan].txtimer);
|
|
|
|
|
|
|
|
netif_tx_disable(dev);
|
|
|
|
|
2024-03-03 11:25:27 +00:00
|
|
|
@@ -6635,7 +6628,7 @@ void stmmac_xdp_release(struct net_devic
|
2023-08-21 05:41:37 +00:00
|
|
|
stmmac_disable_all_queues(priv);
|
|
|
|
|
|
|
|
for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
|
|
|
|
- hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer);
|
|
|
|
+ del_timer_sync(&priv->dma_conf.tx_queue[chan].txtimer);
|
|
|
|
|
|
|
|
/* Free the IRQ lines */
|
|
|
|
stmmac_free_irq(dev, REQ_IRQ_ERR_ALL, 0);
|
2024-03-03 11:25:27 +00:00
|
|
|
@@ -6730,8 +6723,7 @@ int stmmac_xdp_open(struct net_device *d
|
2023-08-21 05:41:37 +00:00
|
|
|
stmmac_set_tx_tail_ptr(priv, priv->ioaddr,
|
|
|
|
tx_q->tx_tail_addr, chan);
|
|
|
|
|
|
|
|
- hrtimer_init(&tx_q->txtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
|
|
|
|
- tx_q->txtimer.function = stmmac_tx_timer;
|
|
|
|
+ timer_setup(&tx_q->txtimer, stmmac_tx_timer, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Enable the MAC Rx/Tx */
|
2024-03-03 11:25:27 +00:00
|
|
|
@@ -6754,7 +6746,7 @@ int stmmac_xdp_open(struct net_device *d
|
2023-08-21 05:41:37 +00:00
|
|
|
|
|
|
|
irq_error:
|
|
|
|
for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
|
|
|
|
- hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer);
|
|
|
|
+ del_timer_sync(&priv->dma_conf.tx_queue[chan].txtimer);
|
|
|
|
|
|
|
|
stmmac_hw_teardown(dev);
|
|
|
|
init_error:
|
2024-03-03 11:25:27 +00:00
|
|
|
@@ -7481,7 +7473,7 @@ int stmmac_suspend(struct device *dev)
|
2023-08-21 05:41:37 +00:00
|
|
|
stmmac_disable_all_queues(priv);
|
|
|
|
|
|
|
|
for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
|
|
|
|
- hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer);
|
|
|
|
+ del_timer_sync(&priv->dma_conf.tx_queue[chan].txtimer);
|
|
|
|
|
|
|
|
if (priv->eee_enabled) {
|
|
|
|
priv->tx_path_in_lpi_mode = false;
|