Skip to content

Commit 317013d

Browse files
cmonroegregkh
authored andcommitted
net: ethernet: mtk_eth_soc: fix SER panic with 4GB+ RAM
[ Upstream commit 6e0490f ] 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 <chad@monroe.io> Link: https://patch.msgid.link/4adc2aaeb0fb1b9cdc56bf21cf8e7fa328daa345.1745715843.git.daniel@makrotopia.org Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 56b958a commit 317013d

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
@@ -2202,14 +2202,18 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
22022202
ring->data[idx] = new_data;
22032203
rxd->rxd1 = (unsigned int)dma_addr;
22042204
release_desc:
2205+
if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA)) {
2206+
if (unlikely(dma_addr == DMA_MAPPING_ERROR))
2207+
addr64 = FIELD_GET(RX_DMA_ADDR64_MASK,
2208+
rxd->rxd2);
2209+
else
2210+
addr64 = RX_DMA_PREP_ADDR64(dma_addr);
2211+
}
2212+
22052213
if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628))
22062214
rxd->rxd2 = RX_DMA_LSO;
22072215
else
2208-
rxd->rxd2 = RX_DMA_PREP_PLEN0(ring->buf_size);
2209-
2210-
if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA) &&
2211-
likely(dma_addr != DMA_MAPPING_ERROR))
2212-
rxd->rxd2 |= RX_DMA_PREP_ADDR64(dma_addr);
2216+
rxd->rxd2 = RX_DMA_PREP_PLEN0(ring->buf_size) | addr64;
22132217

22142218
ring->calc_idx = idx;
22152219
done++;

0 commit comments

Comments
 (0)