1 From 5196c417854942e218a59ec87bf7d414b3bd581e Mon Sep 17 00:00:00 2001
2 From: Felix Fietkau <nbd@nbd.name>
3 Date: Thu, 22 Apr 2021 22:20:55 -0700
4 Subject: [PATCH] net: ethernet: mtk_eth_soc: unmap RX data before calling
7 Since build_skb accesses the data area (for initializing shinfo), dma unmap
8 needs to happen before that call
10 Signed-off-by: Felix Fietkau <nbd@nbd.name>
11 [Ilya: split build_skb cleanup fix into a separate commit]
12 Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
13 Signed-off-by: David S. Miller <davem@davemloft.net>
15 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 5 +++--
16 1 file changed, 3 insertions(+), 2 deletions(-)
18 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
19 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
20 @@ -1334,6 +1334,9 @@ static int mtk_poll_rx(struct napi_struc
24 + dma_unmap_single(eth->dev, trxd.rxd1,
25 + ring->buf_size, DMA_FROM_DEVICE);
28 skb = build_skb(data, ring->frag_size);
30 @@ -1343,8 +1346,6 @@ static int mtk_poll_rx(struct napi_struc
32 skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN);
34 - dma_unmap_single(eth->dev, trxd.rxd1,
35 - ring->buf_size, DMA_FROM_DEVICE);
36 pktlen = RX_DMA_GET_PLEN0(trxd.rxd2);