mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-27 09:12:39 +00:00
be0639063a
Merged upstream: bcm27xx/patches-5.4/950-1014-Revert-mailbox-avoid-timer-start-from-callback.patch generic/backport-5.4/080-wireguard-0021-crypto-blake2s-generic-C-library-implementation-and-.patch Manually adapted: layerscape/patches-5.4/801-audio-0005-Revert-ASoC-fsl_sai-Add-support-for-SAI-new-version.patch oxnas/patches-5.4/100-oxnas-clk-plla-pllb.patch Compile-tested: lantiq/xrx200 Run-tested: lantiq/xrx200 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
45 lines
1.3 KiB
Diff
45 lines
1.3 KiB
Diff
From: Felix Fietkau <nbd@nbd.name>
|
|
Date: Thu, 27 Aug 2020 09:24:25 +0200
|
|
Subject: [PATCH] net: ethernet: mtk_eth_soc: only read the full rx
|
|
descriptor if DMA is done
|
|
|
|
Uncached memory access is expensive, and there is no need to access all
|
|
descriptor words if we can't process them anyway
|
|
|
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
---
|
|
|
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
@@ -793,13 +793,18 @@ static inline int mtk_max_buf_size(int f
|
|
return buf_size;
|
|
}
|
|
|
|
-static inline void mtk_rx_get_desc(struct mtk_rx_dma *rxd,
|
|
+static inline bool mtk_rx_get_desc(struct mtk_rx_dma *rxd,
|
|
struct mtk_rx_dma *dma_rxd)
|
|
{
|
|
- rxd->rxd1 = READ_ONCE(dma_rxd->rxd1);
|
|
rxd->rxd2 = READ_ONCE(dma_rxd->rxd2);
|
|
+ if (!(rxd->rxd2 & RX_DMA_DONE))
|
|
+ return false;
|
|
+
|
|
+ rxd->rxd1 = READ_ONCE(dma_rxd->rxd1);
|
|
rxd->rxd3 = READ_ONCE(dma_rxd->rxd3);
|
|
rxd->rxd4 = READ_ONCE(dma_rxd->rxd4);
|
|
+
|
|
+ return true;
|
|
}
|
|
|
|
static void *mtk_max_lro_buf_alloc(gfp_t gfp_mask)
|
|
@@ -1282,8 +1287,7 @@ static int mtk_poll_rx(struct napi_struc
|
|
rxd = &ring->dma[idx];
|
|
data = ring->data[idx];
|
|
|
|
- mtk_rx_get_desc(&trxd, rxd);
|
|
- if (!(trxd.rxd2 & RX_DMA_DONE))
|
|
+ if (!mtk_rx_get_desc(&trxd, rxd))
|
|
break;
|
|
|
|
/* find out which mac the packet come from. values start at 1 */
|