forked from openwrt/openwrt
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generic: 6.6: mtk_eth_soc: reset all TX queues on DMA free
The purpose of resetting the TX queue is to reset the byte and packet count as well as to clear the software flow control XOFF bit. MediaTek developers pointed out that netdev_reset_queue would only resets queue 0 of the network device. Queues that are not reset may cause unexpected issues. Packets may stop being sent after reset and "transmit timeout" log may be displayed. Import fix from MediaTek's SDK to resolve this issue. Link: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/5746a94456f466446cc0dcdfbd9078df6df31b63 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
- Loading branch information
Showing
2 changed files
with
60 additions
and
9 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
.../linux/generic/pending-6.6/730-net-ethernet-mtk_eth_soc-reset-all-TX-queues-on-DMA-.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
From 7d41a5a8e9c91cc6bb011dd953570738583dd091 Mon Sep 17 00:00:00 2001 | ||
From: Daniel Golle <daniel@makrotopia.org> | ||
Date: Wed, 18 Sep 2024 02:01:01 +0100 | ||
Subject: [PATCH] net: ethernet: mtk_eth_soc: reset all TX queues on DMA free | ||
|
||
The purpose of resetting the TX queue is to reset the | ||
byte and packet count as well as to clear the software | ||
flow control XOFF bit. | ||
|
||
MediaTek developers pointed out that netdev_reset_queue would only | ||
resets queue 0 of the network device. | ||
Queues that are not reset may cause unexpected issues. | ||
|
||
Packets may stop being sent after reset and "transmit timeout" log may | ||
be displayed. | ||
|
||
Import fix from MediaTek's SDK to resolve this issue. | ||
|
||
Signed-off-by: Daniel Golle <daniel@makrotopia.org> | ||
--- | ||
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 18 ++++++++++++++---- | ||
1 file changed, 14 insertions(+), 4 deletions(-) | ||
|
||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c | ||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c | ||
@@ -3135,11 +3135,21 @@ static int mtk_dma_init(struct mtk_eth * | ||
static void mtk_dma_free(struct mtk_eth *eth) | ||
{ | ||
const struct mtk_soc_data *soc = eth->soc; | ||
- int i; | ||
+ int i, j, txqs; | ||
+ | ||
+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) | ||
+ txqs = MTK_QDMA_TX_NUM; | ||
+ else | ||
+ txqs = MTK_PDMA_TX_NUM; | ||
+ | ||
+ for (i = 0; i < MTK_MAC_COUNT; i++) { | ||
+ if (!eth->netdev[i]) | ||
+ continue; | ||
+ | ||
+ for (j = 0; j < txqs; j++) | ||
+ netdev_tx_reset_queue(netdev_get_tx_queue(eth->netdev[i], j)); | ||
+ } | ||
|
||
- for (i = 0; i < MTK_MAX_DEVS; i++) | ||
- if (eth->netdev[i]) | ||
- netdev_reset_queue(eth->netdev[i]); | ||
if (!MTK_HAS_CAPS(soc->caps, MTK_SRAM) && eth->scratch_ring) { | ||
dma_free_coherent(eth->dma_dev, | ||
MTK_QDMA_RING_SIZE * soc->tx.desc_size, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters