]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: ethernet: mtk_eth_soc: reset all TX queues on DMA free
authorDaniel Golle <daniel@makrotopia.org>
Mon, 5 May 2025 01:07:32 +0000 (02:07 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 18 May 2025 06:24:05 +0000 (08:24 +0200)
[ Upstream commit 4db6c75124d871fbabf8243f947d34cc7e0697fc ]

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: f63959c7eec31 ("net: ethernet: mtk_eth_soc: implement multi-queue support for per-port queues")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Link: https://patch.msgid.link/c9ff9adceac4f152239a0f65c397f13547639175.1746406763.git.daniel@makrotopia.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mediatek/mtk_eth_soc.c

index d2ec8f642c2fa0dd13feb787f5f32e39072bdc2c..c6ccfbd422657024d965c28b86d1ffa6523226b9 100644 (file)
@@ -3117,11 +3117,19 @@ static int mtk_dma_init(struct mtk_eth *eth)
 static void mtk_dma_free(struct mtk_eth *eth)
 {
        const struct mtk_soc_data *soc = eth->soc;
-       int i;
+       int i, j, txqs = 1;
+
+       if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA))
+               txqs = MTK_QDMA_NUM_QUEUES;
+
+       for (i = 0; i < MTK_MAX_DEVS; i++) {
+               if (!eth->netdev[i])
+                       continue;
+
+               for (j = 0; j < txqs; j++)
+                       netdev_tx_reset_subqueue(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->txrx.txd_size,