Skip to content

Commit 6e0490f

Browse files
cmonroekuba-moo
authored andcommitted
net: ethernet: mtk_eth_soc: fix SER panic with 4GB+ RAM
If the mtk_poll_rx() function detects the MTK_RESETTING flag, it will jump to release_desc and refill the high word of the SDP on the 4GB RFB. Subsequently, mtk_rx_clean will process an incorrect SDP, leading to a panic. Add patch from MediaTek's SDK to resolve this. Fixes: 2d75891 ("net: ethernet: mtk_eth_soc: support 36-bit DMA addressing on MT7988") Link: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/71f47ea785699c6aa3b922d66c2bdc1a43da25b1 Signed-off-by: Chad Monroe <[email protected]> Link: https://patch.msgid.link/4adc2aaeb0fb1b9cdc56bf21cf8e7fa328daa345.1745715843.git.daniel@makrotopia.org Signed-off-by: Jakub Kicinski <[email protected]>
1 parent b23285e commit 6e0490f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

drivers/net/ethernet/mediatek/mtk_eth_soc.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,14 +2248,18 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
22482248
ring->data[idx] = new_data;
22492249
rxd->rxd1 = (unsigned int)dma_addr;
22502250
release_desc:
2251+
if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA)) {
2252+
if (unlikely(dma_addr == DMA_MAPPING_ERROR))
2253+
addr64 = FIELD_GET(RX_DMA_ADDR64_MASK,
2254+
rxd->rxd2);
2255+
else
2256+
addr64 = RX_DMA_PREP_ADDR64(dma_addr);
2257+
}
2258+
22512259
if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628))
22522260
rxd->rxd2 = RX_DMA_LSO;
22532261
else
2254-
rxd->rxd2 = RX_DMA_PREP_PLEN0(ring->buf_size);
2255-
2256-
if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA) &&
2257-
likely(dma_addr != DMA_MAPPING_ERROR))
2258-
rxd->rxd2 |= RX_DMA_PREP_ADDR64(dma_addr);
2262+
rxd->rxd2 = RX_DMA_PREP_PLEN0(ring->buf_size) | addr64;
22592263

22602264
ring->calc_idx = idx;
22612265
done++;

0 commit comments

Comments
 (0)