From f1f4dfef8cf12348b54491a6c947eba1585500ab Mon Sep 17 00:00:00 2001 From: hanwckf Date: Tue, 10 Sep 2024 01:56:35 +0800 Subject: [PATCH] mediatek: mtk_eth_soc: Change RX DMA L4 valid bit definition --- .../drivers/net/ethernet/mediatek/mtk_eth_soc.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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 8920abe3dc..1cc4cc586f 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 @@ -1382,7 +1382,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, while (done < budget) { struct net_device *netdev; - unsigned int pktlen; + unsigned int pktlen, *rxdcsum; dma_addr_t dma_addr; int mac; @@ -1456,10 +1456,12 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, skb->dev = netdev; skb_put(skb, pktlen); - if ((!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_RX_V2) && - (trxd.rxd4 & eth->rx_dma_l4_valid)) || - (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_RX_V2) && - (trxd.rxd3 & eth->rx_dma_l4_valid))) + if ((MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_RX_V2))) + rxdcsum = &trxd.rxd3; + else + rxdcsum = &trxd.rxd4; + + if (*rxdcsum & eth->rx_dma_l4_valid) skb->ip_summed = CHECKSUM_UNNECESSARY; else skb_checksum_none_assert(skb); @@ -3542,7 +3544,7 @@ static int mtk_probe(struct platform_device *pdev) eth->rx_dma_l4_valid = RX_DMA_L4_VALID_PDMA; eth->ip_align = NET_IP_ALIGN; } else { - if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) + if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_RX_V2)) eth->rx_dma_l4_valid = RX_DMA_L4_VALID_V2; else eth->rx_dma_l4_valid = RX_DMA_L4_VALID;