Openwrt/target/linux/generic/backport-5.10/610-v5.13-38-net-ethernet-mtk_eth_soc-unmap-RX-data-before-callin.patch
Rui Salvaterra da77b9c2f1 kernel: bump 5.10 to 5.10.42
Deleted (reverse-appliable):
generic/pending-5.10/110-perf-jevents-fix-getting-maximum-number-of-fds.patch

Manually refreshed:
ramips/patches-5.10/835-asoc-add-mt7620-support.patch

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2021-06-06 00:24:07 +02:00

39 lines
1.3 KiB
Diff

From 5196c417854942e218a59ec87bf7d414b3bd581e Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@nbd.name>
Date: Thu, 22 Apr 2021 22:20:55 -0700
Subject: [PATCH] net: ethernet: mtk_eth_soc: unmap RX data before calling
build_skb
Since build_skb accesses the data area (for initializing shinfo), dma unmap
needs to happen before that call
Signed-off-by: Felix Fietkau <nbd@nbd.name>
[Ilya: split build_skb cleanup fix into a separate commit]
Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -1319,6 +1319,9 @@ static int mtk_poll_rx(struct napi_struc
goto release_desc;
}
+ dma_unmap_single(eth->dev, trxd.rxd1,
+ ring->buf_size, DMA_FROM_DEVICE);
+
/* receive data */
skb = build_skb(data, ring->frag_size);
if (unlikely(!skb)) {
@@ -1328,8 +1331,6 @@ static int mtk_poll_rx(struct napi_struc
}
skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN);
- dma_unmap_single(eth->dev, trxd.rxd1,
- ring->buf_size, DMA_FROM_DEVICE);
pktlen = RX_DMA_GET_PLEN0(trxd.rxd2);
skb->dev = netdev;
skb_put(skb, pktlen);