forked from Openwrt/openwrt
dceb5938f8
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.29 Removed upstreamed: generic/backport-6.6/740-v6.9-01-netfilter-flowtable-validate-pppoe-header.patch[1] generic/backport-6.6/740-v6.9-02-netfilter-flowtable-incorrect-pppoe-tuple.patch[2] generic/backport-6.6/790-29-v6.9-net-dsa-mt7530-fix-improper-frames-on-all-25MHz-and-.patch[3] generic/backport-6.6/790-31-v6.10-net-dsa-mt7530-fix-enabling-EEE-on-MT7531-switch-on-.patch[4] generic/backport-6.6/790-34-v6.10-net-dsa-mt7530-fix-mirroring-frames-received-on-loca.patch[5] generic/backport-6.6/790-35-v6.10-net-dsa-mt7530-fix-port-mirroring-for-MT7988-SoC-swi.patch[6] mediatek/patches-6.6/963-net-ethernet-mtk_eth_soc-fix-WED-wifi-reset.patch[7] Manually rebased: generic/backport-6.6/790-23-v6.9-net-dsa-mt7530-get-rid-of-priv-info-cpu_port_config.patch All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.29&id=a2471d271042ea18e8a6babc132a8716bb2f08b9 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.29&id=4ed82dd368ad883dc4284292937b882f044e625d 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.29&id=21b9d89d93422221cdda1b82fd075fa3c94a11d9 4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.29&id=bd41ee1efd478852a0882ce5f136bc2b5e83eff2 5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.29&id=d1be3960539249a8690ed09a29d0e3bf34189dd2 6. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.29&id=f8de1b6208bf71bd3102548d33dd8475573ad2ea 7. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.29&id=6855f724f19620c3ddff57c349e0abba797475b1 Build system: x86/64 Build-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia <therealgraysky@proton.me>
78 lines
3.0 KiB
Diff
78 lines
3.0 KiB
Diff
From 2d1a42cf7f77cda54dbbee18d00b1200e7bc22aa Mon Sep 17 00:00:00 2001
|
|
From: Christian Marangi <ansuelsmth@gmail.com>
|
|
Date: Wed, 18 Oct 2023 14:35:48 +0200
|
|
Subject: [PATCH 1/3] net: stmmac: improve TX timer arm logic
|
|
|
|
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 <ansuelsmth@gmail.com>
|
|
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
|
---
|
|
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 18 +++++++++++++++---
|
|
1 file changed, 15 insertions(+), 3 deletions(-)
|
|
|
|
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
|
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
|
@@ -2988,13 +2988,25 @@ static void stmmac_tx_timer_arm(struct s
|
|
{
|
|
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);
|
|
}
|
|
|
|
/**
|