Skip to content

Commit 4db6c75

Browse files
dangowrtPaolo Abeni
authored andcommitted
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. Link: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/319c0d9905579a46dc448579f892f364f1f84818 Fixes: f63959c ("net: ethernet: mtk_eth_soc: implement multi-queue support for per-port queues") Signed-off-by: Daniel Golle <[email protected]> Link: https://patch.msgid.link/c9ff9adceac4f152239a0f65c397f13547639175.1746406763.git.daniel@makrotopia.org Signed-off-by: Paolo Abeni <[email protected]>
1 parent 4720f97 commit 4db6c75

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

drivers/net/ethernet/mediatek/mtk_eth_soc.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3186,11 +3186,19 @@ static int mtk_dma_init(struct mtk_eth *eth)
31863186
static void mtk_dma_free(struct mtk_eth *eth)
31873187
{
31883188
const struct mtk_soc_data *soc = eth->soc;
3189-
int i;
3189+
int i, j, txqs = 1;
3190+
3191+
if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA))
3192+
txqs = MTK_QDMA_NUM_QUEUES;
3193+
3194+
for (i = 0; i < MTK_MAX_DEVS; i++) {
3195+
if (!eth->netdev[i])
3196+
continue;
3197+
3198+
for (j = 0; j < txqs; j++)
3199+
netdev_tx_reset_subqueue(eth->netdev[i], j);
3200+
}
31903201

3191-
for (i = 0; i < MTK_MAX_DEVS; i++)
3192-
if (eth->netdev[i])
3193-
netdev_reset_queue(eth->netdev[i]);
31943202
if (!MTK_HAS_CAPS(soc->caps, MTK_SRAM) && eth->scratch_ring) {
31953203
dma_free_coherent(eth->dma_dev,
31963204
MTK_QDMA_RING_SIZE * soc->tx.desc_size,

0 commit comments

Comments
 (0)