2022-09-13 17:04:12 +00:00
|
|
|
From f9ec5723c3dbfcede9c7b0dcdf85e401ce16316c Mon Sep 17 00:00:00 2001
|
|
|
|
From: Christian Marangi <ansuelsmth@gmail.com>
|
|
|
|
Date: Sat, 23 Jul 2022 16:29:29 +0200
|
|
|
|
Subject: [PATCH 1/5] net: ethernet: stmicro: stmmac: move queue reset to
|
|
|
|
dedicated functions
|
|
|
|
|
|
|
|
Move queue reset to dedicated functions. This aside from a simple
|
|
|
|
cleanup is also required to allocate a dma conf without resetting the tx
|
|
|
|
queue while the device is temporarily detached as now the reset is not
|
|
|
|
part of the dma init function and can be done later in the code flow.
|
|
|
|
|
|
|
|
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|
|
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
|
|
|
---
|
|
|
|
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 59 ++++++++++---------
|
|
|
|
1 file changed, 31 insertions(+), 28 deletions(-)
|
|
|
|
|
|
|
|
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
|
|
|
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
|
|
|
@@ -130,6 +130,9 @@ static irqreturn_t stmmac_mac_interrupt(
|
|
|
|
static irqreturn_t stmmac_safety_interrupt(int irq, void *dev_id);
|
|
|
|
static irqreturn_t stmmac_msi_intr_tx(int irq, void *data);
|
|
|
|
static irqreturn_t stmmac_msi_intr_rx(int irq, void *data);
|
|
|
|
+static void stmmac_reset_rx_queue(struct stmmac_priv *priv, u32 queue);
|
|
|
|
+static void stmmac_reset_tx_queue(struct stmmac_priv *priv, u32 queue);
|
|
|
|
+static void stmmac_reset_queues_param(struct stmmac_priv *priv);
|
|
|
|
static void stmmac_tx_timer_arm(struct stmmac_priv *priv, u32 queue);
|
|
|
|
static void stmmac_flush_tx_descriptors(struct stmmac_priv *priv, int 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
|
|
|
@@ -1713,9 +1716,6 @@ static int __init_dma_rx_desc_rings(stru
|
2022-09-13 17:04:12 +00:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
- rx_q->cur_rx = 0;
|
|
|
|
- rx_q->dirty_rx = 0;
|
|
|
|
-
|
|
|
|
/* Setup the chained descriptor addresses */
|
|
|
|
if (priv->mode == STMMAC_CHAIN_MODE) {
|
|
|
|
if (priv->extend_desc)
|
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
|
|
|
@@ -1821,12 +1821,6 @@ static int __init_dma_tx_desc_rings(stru
|
2022-09-13 17:04:12 +00:00
|
|
|
tx_q->tx_skbuff[i] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
- tx_q->dirty_tx = 0;
|
|
|
|
- tx_q->cur_tx = 0;
|
|
|
|
- tx_q->mss = 0;
|
|
|
|
-
|
|
|
|
- netdev_tx_reset_queue(netdev_get_tx_queue(priv->dev, queue));
|
|
|
|
-
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
@@ -2695,10 +2689,7 @@ static void stmmac_tx_err(struct stmmac_
|
2022-09-13 17:04:12 +00:00
|
|
|
stmmac_stop_tx_dma(priv, chan);
|
|
|
|
dma_free_tx_skbufs(priv, chan);
|
|
|
|
stmmac_clear_tx_descriptors(priv, chan);
|
|
|
|
- tx_q->dirty_tx = 0;
|
|
|
|
- tx_q->cur_tx = 0;
|
|
|
|
- tx_q->mss = 0;
|
|
|
|
- netdev_tx_reset_queue(netdev_get_tx_queue(priv->dev, chan));
|
|
|
|
+ stmmac_reset_tx_queue(priv, chan);
|
|
|
|
stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg,
|
|
|
|
tx_q->dma_tx_phy, chan);
|
|
|
|
stmmac_start_tx_dma(priv, chan);
|
2024-01-26 21:55:30 +00:00
|
|
|
@@ -3783,6 +3774,8 @@ static int stmmac_open(struct net_device
|
2022-10-05 10:04:11 +00:00
|
|
|
}
|
2022-09-13 17:04:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ stmmac_reset_queues_param(priv);
|
|
|
|
+
|
|
|
|
ret = stmmac_hw_setup(dev, true);
|
|
|
|
if (ret < 0) {
|
|
|
|
netdev_err(priv->dev, "%s: Hw setup failed\n", __func__);
|
2024-01-26 21:55:30 +00:00
|
|
|
@@ -6430,6 +6423,7 @@ void stmmac_enable_rx_queue(struct stmma
|
2022-09-13 17:04:12 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ stmmac_reset_rx_queue(priv, queue);
|
|
|
|
stmmac_clear_rx_descriptors(priv, queue);
|
|
|
|
|
|
|
|
stmmac_init_rx_chan(priv, priv->ioaddr, priv->plat->dma_cfg,
|
2024-01-26 21:55:30 +00:00
|
|
|
@@ -6491,6 +6485,7 @@ void stmmac_enable_tx_queue(struct stmma
|
2022-09-13 17:04:12 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ stmmac_reset_tx_queue(priv, queue);
|
|
|
|
stmmac_clear_tx_descriptors(priv, queue);
|
|
|
|
|
|
|
|
stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg,
|
2024-01-26 21:55:30 +00:00
|
|
|
@@ -7415,6 +7410,25 @@ int stmmac_suspend(struct device *dev)
|
2022-09-13 17:04:12 +00:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(stmmac_suspend);
|
|
|
|
|
|
|
|
+static void stmmac_reset_rx_queue(struct stmmac_priv *priv, u32 queue)
|
|
|
|
+{
|
|
|
|
+ struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
|
|
|
|
+
|
|
|
|
+ rx_q->cur_rx = 0;
|
|
|
|
+ rx_q->dirty_rx = 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void stmmac_reset_tx_queue(struct stmmac_priv *priv, u32 queue)
|
|
|
|
+{
|
|
|
|
+ struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
|
|
|
|
+
|
|
|
|
+ tx_q->cur_tx = 0;
|
|
|
|
+ tx_q->dirty_tx = 0;
|
|
|
|
+ tx_q->mss = 0;
|
|
|
|
+
|
|
|
|
+ netdev_tx_reset_queue(netdev_get_tx_queue(priv->dev, queue));
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* stmmac_reset_queues_param - reset queue parameters
|
|
|
|
* @priv: device pointer
|
2024-01-26 21:55:30 +00:00
|
|
|
@@ -7425,22 +7439,11 @@ static void stmmac_reset_queues_param(st
|
2022-09-13 17:04:12 +00:00
|
|
|
u32 tx_cnt = priv->plat->tx_queues_to_use;
|
|
|
|
u32 queue;
|
|
|
|
|
|
|
|
- for (queue = 0; queue < rx_cnt; queue++) {
|
|
|
|
- struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
|
|
|
|
+ for (queue = 0; queue < rx_cnt; queue++)
|
|
|
|
+ stmmac_reset_rx_queue(priv, queue);
|
|
|
|
|
|
|
|
- rx_q->cur_rx = 0;
|
|
|
|
- rx_q->dirty_rx = 0;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- for (queue = 0; queue < tx_cnt; queue++) {
|
|
|
|
- struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
|
|
|
|
-
|
|
|
|
- tx_q->cur_tx = 0;
|
|
|
|
- tx_q->dirty_tx = 0;
|
|
|
|
- tx_q->mss = 0;
|
|
|
|
-
|
|
|
|
- netdev_tx_reset_queue(netdev_get_tx_queue(priv->dev, queue));
|
|
|
|
- }
|
|
|
|
+ for (queue = 0; queue < tx_cnt; queue++)
|
|
|
|
+ stmmac_reset_tx_queue(priv, queue);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|