[][HIGH][kernel][common][eth][Fix ADMAv1/v2 RSS ring memory leak issue]
[Description]
Fix ADMAv1/v2 RSS ring memory leak issue.
Due to incorrect memory release method, memory leak issue occurs
when executing network restart. Without SRAM, a single network
restart will leak approximately 98KB of memory.
Without this patch, not using SRAM may lead to memory exhaustion
and cause the system crash.
[Release-log]
N/A
Change-Id: I80a04e7755b679ff391bd6f8f1a9c3efef2dbe87
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/9180999
diff --git a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 5cc5cae..f30c5c7 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -3694,8 +3694,8 @@
eth->phy_scratch_ring = 0;
}
mtk_tx_clean(eth);
- mtk_rx_clean(eth, ð->rx_ring[0],eth->soc->has_sram);
- mtk_rx_clean(eth, ð->rx_ring_qdma,0);
+ mtk_rx_clean(eth, ð->rx_ring[0], soc->has_sram);
+ mtk_rx_clean(eth, ð->rx_ring_qdma, 0);
if (eth->hwlro) {
mtk_hwlro_rx_uninit(eth);
@@ -3708,7 +3708,7 @@
mtk_rss_uninit(eth);
for (i = 0; i < MTK_RX_RSS_NUM; i++)
- mtk_rx_clean(eth, ð->rx_ring[MTK_RSS_RING(i)], 1);
+ mtk_rx_clean(eth, ð->rx_ring[MTK_RSS_RING(i)], soc->has_sram);
}
for (i = 0; i < DIV_ROUND_UP(soc->txrx.fq_dma_size, MTK_FQ_DMA_LENGTH); i++) {