268b372388f98e6a1d8d3ea63a98103b2949f134
[openwrt/staging/xback.git] /
1 From: Lorenzo Bianconi <lorenzo@kernel.org>
2 Date: Fri, 20 May 2022 20:11:26 +0200
3 Subject: [PATCH] net: ethernet: mtk_eth_soc: rely on GFP_KERNEL for
4 dma_alloc_coherent whenever possible
5
6 Rely on GFP_KERNEL for dma descriptors mappings in mtk_tx_alloc(),
7 mtk_rx_alloc() and mtk_init_fq_dma() since they are run in non-irq
8 context.
9
10 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
11 Signed-off-by: David S. Miller <davem@davemloft.net>
12 ---
13
14 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
15 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
16 @@ -856,7 +856,7 @@ static int mtk_init_fq_dma(struct mtk_et
17 eth->scratch_ring = dma_alloc_coherent(eth->dma_dev,
18 cnt * sizeof(struct mtk_tx_dma),
19 &eth->phy_scratch_ring,
20 - GFP_ATOMIC);
21 + GFP_KERNEL);
22 if (unlikely(!eth->scratch_ring))
23 return -ENOMEM;
24
25 @@ -1634,7 +1634,7 @@ static int mtk_tx_alloc(struct mtk_eth *
26 goto no_tx_mem;
27
28 ring->dma = dma_alloc_coherent(eth->dma_dev, MTK_DMA_SIZE * sz,
29 - &ring->phys, GFP_ATOMIC);
30 + &ring->phys, GFP_KERNEL);
31 if (!ring->dma)
32 goto no_tx_mem;
33
34 @@ -1652,8 +1652,7 @@ static int mtk_tx_alloc(struct mtk_eth *
35 */
36 if (!MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) {
37 ring->dma_pdma = dma_alloc_coherent(eth->dma_dev, MTK_DMA_SIZE * sz,
38 - &ring->phys_pdma,
39 - GFP_ATOMIC);
40 + &ring->phys_pdma, GFP_KERNEL);
41 if (!ring->dma_pdma)
42 goto no_tx_mem;
43
44 @@ -1768,7 +1767,7 @@ static int mtk_rx_alloc(struct mtk_eth *
45
46 ring->dma = dma_alloc_coherent(eth->dma_dev,
47 rx_dma_size * sizeof(*ring->dma),
48 - &ring->phys, GFP_ATOMIC);
49 + &ring->phys, GFP_KERNEL);
50 if (!ring->dma)
51 return -ENOMEM;
52