* [PATCH net v6 0/4] net: ethernet: mtk_wed: misc fixes
@ 2026-10-26 9:57 Zhi-Jun You
2026-10-26 9:57 ` [PATCH net v6 1/4] net: ethernet: mtk_wed: skip ring reset in wdma_tx_ring_setup for WED v3 Zhi-Jun You
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Zhi-Jun You @ 2026-10-26 9:57 UTC (permalink / raw)
To: Felix Fietkau, Lorenzo Bianconi, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Matthias Brugger,
AngeloGioacchino Del Regno, Sujuan Chen, Rex Lu
Cc: netdev, linux-kernel, linux-arm-kernel, linux-mediatek, Sashiko,
Zhi-Jun You
Ths patch series includes some fixes for issues that were discovered
by Sashiko and one original patch fixing issue I encountered.
Patch 1,2,3 fix issues that were found by Sashiko.
Patch 1 was compiled test only.
Patch 2,3,4 were tested on a mt7986.
Patch 1 fixes tx wdma ring reset for WED v3.
Patch 2 fixes the reset condition for rx wdma.
Patch 3 fixes rx ring and tx wdma ring not being freed up
Patch 4 fixes WED on non-DBDC mt7986.
---
Changes in v6:
- Update cover letter to address the platform that the patches were
tested on.
- Update message of patch 2 to clarify what's the issue.
- Update patch 3 to rely on ring descriptor instead of an extra flag.
- Squashed patch 5 into patch 4.
- Lin to v5: https://lore.kernel.org/all/20261016-wedfix-v5-0-8b02e78fd34f@gmail.com/
Changes in v5:
- Add cover letter.
- Add patch 3 to address Sashiko review on rx ring and tx wdma ring not
being freed up.
- Add patch 5 to address Sashiko review on error handling.
- Link to review: https://lore.kernel.org/all/179000700034.2160803.10594281691384015089@kernel.org/
Changes in v4:
- Add patch 2 to address Sashiko review on rx wdma reset condition.
- Link to review: https://lore.kernel.org/all/20260730090030.201100-1-pabeni@redhat.com/
Changes in v3:
- Add patch 1 to address Sashiko review on WED v3 tx wdma ring reset.
- Link to review: https://lore.kernel.org/netdev/20260706101044.161059-1-pabeni@redhat.com/
Changes in v2:
- Address issues raisied by Sashiko in patch 4
- Link to review: https://lore.kernel.org/all/20260706101044.161059-1-pabeni@redhat.com/
- Add comment to explain the special case
- Link to v1: https://lore.kernel.org/all/20260630144831.1109-1-hujy652@gmail.com/
---
To: Felix Fietkau <nbd@nbd.name>
To: Lorenzo Bianconi <lorenzo@kernel.org>
To: Andrew Lunn <andrew+netdev@lunn.ch>
To: "David S. Miller" <davem@davemloft.net>
To: Eric Dumazet <edumazet@kernel.org>
To: Jakub Kicinski <kuba@kernel.org>
To: Paolo Abeni <pabeni@redhat.com>
To: Matthias Brugger <matthias.bgg@gmail.com>
To: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: Sujuan Chen <sujuan.chen@mediatek.com>
To: Rex Lu <rex.lu@mediatek.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@lists.infradead.org
---
Zhi-Jun You (4):
net: ethernet: mtk_wed: skip ring reset in wdma_tx_ring_setup for WED v3
net: ethernet: mtk_wed: fix reset condition for rx wdma
net: ethernet: mtk_wed: free up rings during detach
net: ethernet: mtk_wed: setup WDMA_RING_TX(0) for non-DBDC MT7986
drivers/net/ethernet/mediatek/mtk_wed.c | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
---
base-commit: 7076f684d5132e6a6145e1da2fa74771ecd052e5
change-id: 20261018-wedfix-a60905150472
Best regards,
--
Zhi-Jun You <hujy652@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net v6 1/4] net: ethernet: mtk_wed: skip ring reset in wdma_tx_ring_setup for WED v3
2026-10-26 9:57 [PATCH net v6 0/4] net: ethernet: mtk_wed: misc fixes Zhi-Jun You
@ 2026-10-26 9:57 ` Zhi-Jun You
2026-10-26 9:57 ` [PATCH net v6 2/4] net: ethernet: mtk_wed: fix reset condition for rx wdma Zhi-Jun You
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Zhi-Jun You @ 2026-10-26 9:57 UTC (permalink / raw)
To: Felix Fietkau, Lorenzo Bianconi, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Matthias Brugger,
AngeloGioacchino Del Regno, Sujuan Chen, Rex Lu
Cc: netdev, linux-kernel, linux-arm-kernel, linux-mediatek, Sashiko,
Zhi-Jun You
Currently WED v3 tx wdma ring, ring reset happens in a separate code
block unconditionally.
Moreover, v3 has double the size of wdma_desc and has different init
values. mtk_wed_ring_reset doens't deal with that and would corrupt the
wdma_desc.
Fix this by skipping mtk_wed_ring_reset in mtk_wdma_tx_ring_setup for
WED v3.
Fixes: e2f64db13aa1 ("net: ethernet: mtk_wed: introduce WED support for MT7988")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20260711112128.971-1-hujy652@gmail.com?part=1
Signed-off-by: Zhi-Jun You <hujy652@gmail.com>
---
drivers/net/ethernet/mediatek/mtk_wed.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
index 53d3b7e00e1c..d55042ccaff1 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
@@ -1938,7 +1938,7 @@ mtk_wed_wdma_tx_ring_setup(struct mtk_wed_device *dev, int idx, int size,
wdma_w32(dev, MTK_WDMA_RING_TX(idx) + MTK_WED_RING_OFS_CPU_IDX, 0);
wdma_w32(dev, MTK_WDMA_RING_TX(idx) + MTK_WED_RING_OFS_DMA_IDX, 0);
- if (reset)
+ if (!mtk_wed_is_v3_or_greater(dev->hw) && reset)
mtk_wed_ring_reset(wdma, MTK_WED_WDMA_RING_SIZE, true);
if (!idx) {
--
2.55.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net v6 2/4] net: ethernet: mtk_wed: fix reset condition for rx wdma
2026-10-26 9:57 [PATCH net v6 0/4] net: ethernet: mtk_wed: misc fixes Zhi-Jun You
2026-10-26 9:57 ` [PATCH net v6 1/4] net: ethernet: mtk_wed: skip ring reset in wdma_tx_ring_setup for WED v3 Zhi-Jun You
@ 2026-10-26 9:57 ` Zhi-Jun You
2026-10-26 9:57 ` [PATCH net v6 3/4] net: ethernet: mtk_wed: free up rings during detach Zhi-Jun You
2026-10-26 9:57 ` [PATCH net v6 4/4] net: ethernet: mtk_wed: setup WDMA_RING_TX(0) for non-DBDC MT7986 Zhi-Jun You
3 siblings, 0 replies; 5+ messages in thread
From: Zhi-Jun You @ 2026-10-26 9:57 UTC (permalink / raw)
To: Felix Fietkau, Lorenzo Bianconi, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Matthias Brugger,
AngeloGioacchino Del Regno, Sujuan Chen, Rex Lu
Cc: netdev, linux-kernel, linux-arm-kernel, linux-mediatek, Sashiko,
Zhi-Jun You
In mtk_wdma_rx_reset, currently only resets the CPU index of the rings
that doesn't have a descriptor. This is wrong because no descriptor
means the ring is not configured.
Also mtk_wed_start makes sure that all rx_wdma rings are set up this
would lead to no ring getting their CPU index reset.
Fix this by inverting the reset condition so allocated rings will be
reset.
Fixes: 4c5de09eb0d0 ("net: ethernet: mtk_wed: add configure wed wo support")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20260724172040.1653-1-hujy652%40gmail.com
Signed-off-by: Zhi-Jun You <hujy652@gmail.com>
---
drivers/net/ethernet/mediatek/mtk_wed.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
index d55042ccaff1..3f0be70c3f14 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
@@ -257,7 +257,7 @@ mtk_wdma_rx_reset(struct mtk_wed_device *dev)
wdma_w32(dev, MTK_WDMA_RESET_IDX, 0);
for (i = 0; i < ARRAY_SIZE(dev->rx_wdma); i++) {
- if (dev->rx_wdma[i].desc)
+ if (!dev->rx_wdma[i].desc)
continue;
wdma_w32(dev,
--
2.55.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net v6 3/4] net: ethernet: mtk_wed: free up rings during detach
2026-10-26 9:57 [PATCH net v6 0/4] net: ethernet: mtk_wed: misc fixes Zhi-Jun You
2026-10-26 9:57 ` [PATCH net v6 1/4] net: ethernet: mtk_wed: skip ring reset in wdma_tx_ring_setup for WED v3 Zhi-Jun You
2026-10-26 9:57 ` [PATCH net v6 2/4] net: ethernet: mtk_wed: fix reset condition for rx wdma Zhi-Jun You
@ 2026-10-26 9:57 ` Zhi-Jun You
2026-10-26 9:57 ` [PATCH net v6 4/4] net: ethernet: mtk_wed: setup WDMA_RING_TX(0) for non-DBDC MT7986 Zhi-Jun You
3 siblings, 0 replies; 5+ messages in thread
From: Zhi-Jun You @ 2026-10-26 9:57 UTC (permalink / raw)
To: Felix Fietkau, Lorenzo Bianconi, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Matthias Brugger,
AngeloGioacchino Del Regno, Sujuan Chen, Rex Lu
Cc: netdev, linux-kernel, linux-arm-kernel, linux-mediatek, Sashiko,
Zhi-Jun You
During __mtk_wed_detach, rx_ring and tx_wdma aren't freed up.
Fix this by add them to mtk_wed_free_rx_rings.
This patch is pulled from mtk-openwrt-feeds to address Sashiko's review
and edit to rely on ring->desc instead of an extra flag.
Link: https://github.com/mediatek/mtk-openwrt-feeds/blob/main/25.12/files/target/linux/mediatek/patches-6.12/999-wed-04-Fix-reinsert-wifi-module-cause-memory-leak-issue.patch
Fixes: 4c5de09eb0d0 ("net: ethernet: mtk_wed: add configure wed wo support")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/message/179000700034.2160803.10594281691384015089%40kernel.org
Signed-off-by: Zhi-Jun You <hujy652@gmail.com>
---
drivers/net/ethernet/mediatek/mtk_wed.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
index 3f0be70c3f14..3044a7a8ea03 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
@@ -949,6 +949,14 @@ mtk_wed_free_ring(struct mtk_wed_device *dev, struct mtk_wed_ring *ring)
static void
mtk_wed_free_rx_rings(struct mtk_wed_device *dev)
{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(dev->rx_ring); i++)
+ mtk_wed_free_ring(dev, &dev->rx_ring[i]);
+
+ for (i = 0; i < ARRAY_SIZE(dev->tx_wdma); i++)
+ mtk_wed_free_ring(dev, &dev->tx_wdma[i]);
+
mtk_wed_free_rx_buffer(dev);
mtk_wed_free_ring(dev, &dev->rro.ring);
}
--
2.55.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net v6 4/4] net: ethernet: mtk_wed: setup WDMA_RING_TX(0) for non-DBDC MT7986
2026-10-26 9:57 [PATCH net v6 0/4] net: ethernet: mtk_wed: misc fixes Zhi-Jun You
` (2 preceding siblings ...)
2026-10-26 9:57 ` [PATCH net v6 3/4] net: ethernet: mtk_wed: free up rings during detach Zhi-Jun You
@ 2026-10-26 9:57 ` Zhi-Jun You
3 siblings, 0 replies; 5+ messages in thread
From: Zhi-Jun You @ 2026-10-26 9:57 UTC (permalink / raw)
To: Felix Fietkau, Lorenzo Bianconi, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Matthias Brugger,
AngeloGioacchino Del Regno, Sujuan Chen, Rex Lu
Cc: netdev, linux-kernel, linux-arm-kernel, linux-mediatek, Zhi-Jun You
WDMA_RING_TX(0) is required to set MTK_WED_WDMA_RING_TX for WED RX
but on a non-DBDC MT7986 it is never setup because idx is 1.
Setting MTK_WED_WDMA_RING_TX with WDMA_RING_TX(1) is not feasible because
WED still tries to send through WDMA_RING_TX(0). This is verified with
register dump.
Fix this by calling mtk_wed_wdma_tx_ring_setup if wed is v2 and
rx_ring[0] is not allocated and reset tx_wdma[0] if it's already
allocated also add error messages and bail when mtk_wed_start fails.
Fixes: 4c5de09eb0d0 ("net: ethernet: mtk_wed: add configure wed wo support")
Signed-off-by: Zhi-Jun You <hujy652@gmail.com>
---
drivers/net/ethernet/mediatek/mtk_wed.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
index 3044a7a8ea03..f40ac5794341 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
@@ -2345,7 +2345,20 @@ mtk_wed_start(struct mtk_wed_device *dev, u32 irq_mask)
for (i = 0; i < ARRAY_SIZE(dev->rx_wdma); i++)
if (!dev->rx_wdma[i].desc)
- mtk_wed_wdma_rx_ring_setup(dev, i, 16, false);
+ if (mtk_wed_wdma_rx_ring_setup(dev, i, 16, false)) {
+ dev_err(dev->hw->dev, "wdma rx ring %d setup failed\n", i);
+ return;
+ }
+
+ /*
+ * non-DBDC MT7986 allocates only rx_ring[1] and tx_wdma[1] during setup
+ * but tx_wdma[0] is also needed for WED to function.
+ */
+ if (mtk_wed_is_v2(dev->hw) && !dev->rx_ring[0].desc)
+ if (mtk_wed_wdma_tx_ring_setup(dev, 0, MTK_WED_WDMA_RING_SIZE, !!dev->tx_wdma[0].desc)) {
+ dev_err(dev->hw->dev, "wdma tx ring 0 setup failed\n");
+ return;
+ }
if (dev->wlan.hw_rro) {
for (i = 0; i < MTK_WED_RX_PAGE_QUEUES; i++) {
--
2.55.0
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-10-26 9:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-26 9:57 [PATCH net v6 0/4] net: ethernet: mtk_wed: misc fixes Zhi-Jun You
2026-10-26 9:57 ` [PATCH net v6 1/4] net: ethernet: mtk_wed: skip ring reset in wdma_tx_ring_setup for WED v3 Zhi-Jun You
2026-10-26 9:57 ` [PATCH net v6 2/4] net: ethernet: mtk_wed: fix reset condition for rx wdma Zhi-Jun You
2026-10-26 9:57 ` [PATCH net v6 3/4] net: ethernet: mtk_wed: free up rings during detach Zhi-Jun You
2026-10-26 9:57 ` [PATCH net v6 4/4] net: ethernet: mtk_wed: setup WDMA_RING_TX(0) for non-DBDC MT7986 Zhi-Jun You
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®