[][kernel][mt7988][eth][Fix panic issue during SER test on the 4GB RFB]
[Description]
Fix panic issue during SER test on the 4GB RFB.
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.
Without this patch, the kernel will panic in the mtk_rx_clean() function
during SER test.
[Release-log]
N/A
Change-Id: I097ff1b8898dde20edfd7631f626a85582bfc955
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/8445456
diff --git a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/999-3003-add-wed.patch b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/999-3003-add-wed.patch
index 09502e9..0159e20 100644
--- a/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/999-3003-add-wed.patch
+++ b/autobuild_mac80211_release/target/linux/mediatek/patches-5.4/999-3003-add-wed.patch
@@ -154,11 +154,11 @@
@@ -2191,6 +2193,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
unsigned int pktlen, *rxdcsum;
struct net_device *netdev = NULL;
- dma_addr_t dma_addr = 0;
+ dma_addr_t dma_addr;
+ u32 hash, reason;
int mac = 0;
- if (eth->hwlro)
+ dma_addr = DMA_MAPPING_ERROR;
@@ -2282,6 +2285,17 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
skb_checksum_none_assert(skb);
skb->protocol = eth_type_trans(skb, netdev);
diff --git a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 010c992..3b32cc3 100644
--- a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -2170,9 +2170,11 @@
while (done < budget) {
unsigned int pktlen, *rxdcsum;
struct net_device *netdev = NULL;
- dma_addr_t dma_addr = 0;
+ dma_addr_t dma_addr;
int mac = 0;
+ dma_addr = DMA_MAPPING_ERROR;
+
idx = NEXT_DESP_IDX(ring->calc_idx, ring->dma_size);
rxd = ring->dma + idx * eth->soc->txrx.rxd_size;
data = ring->data[idx];
@@ -2229,7 +2231,7 @@
((u64)(trxd.rxd2 & 0xf)) << 32 : 0;
dma_unmap_single(eth->dma_dev,
- (u64)(trxd.rxd1 | addr64),
+ ((u64)(trxd.rxd1) | addr64),
ring->buf_size, DMA_FROM_DEVICE);
/* receive data */
@@ -2318,7 +2320,7 @@
if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628))
rxd->rxd2 = RX_DMA_LSO;
- else
+ else if (dma_addr != DMA_MAPPING_ERROR)
rxd->rxd2 = RX_DMA_PLEN0(ring->buf_size) | addr64;
ring->calc_idx = idx;
@@ -2800,7 +2802,7 @@
((u64)(rxd->rxd2 & 0xf)) << 32 : 0;
dma_unmap_single(eth->dma_dev,
- (u64)(rxd->rxd1 | addr64),
+ ((u64)(rxd->rxd1) | addr64),
ring->buf_size,
DMA_FROM_DEVICE);
skb_free_frag(ring->data[i]);