Skip to content

Commit 3abc0e5

Browse files
Rex Ludavem330
authored andcommitted
net: mtk: wed: add dma mask limitation and GFP_DMA32 for device with more than 4GB DRAM
Limit tx/rx buffer address to 32-bit address space for board with more than 4GB DRAM. Fixes: 804775d ("net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED)") Fixes: 6757d34 ("net: ethernet: mtk_wed: introduce hw_rro support for MT7988") Tested-by: Daniel Pawlik <pawlik.dan@gmail.com> Tested-by: Matteo Croce <teknoraver@meta.com> Signed-off-by: Rex Lu <rex.lu@mediatek.com> Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d5d790b commit 3abc0e5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/net/ethernet/mediatek/mtk_wed.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ mtk_wed_tx_buffer_alloc(struct mtk_wed_device *dev)
677677
void *buf;
678678
int s;
679679

680-
page = __dev_alloc_page(GFP_KERNEL);
680+
page = __dev_alloc_page(GFP_KERNEL | GFP_DMA32);
681681
if (!page)
682682
return -ENOMEM;
683683

@@ -800,7 +800,7 @@ mtk_wed_hwrro_buffer_alloc(struct mtk_wed_device *dev)
800800
struct page *page;
801801
int s;
802802

803-
page = __dev_alloc_page(GFP_KERNEL);
803+
page = __dev_alloc_page(GFP_KERNEL | GFP_DMA32);
804804
if (!page)
805805
return -ENOMEM;
806806

@@ -2426,6 +2426,10 @@ mtk_wed_attach(struct mtk_wed_device *dev)
24262426
dev->version = hw->version;
24272427
dev->hw->pcie_base = mtk_wed_get_pcie_base(dev);
24282428

2429+
ret = dma_set_mask_and_coherent(hw->dev, DMA_BIT_MASK(32));
2430+
if (ret)
2431+
goto out;
2432+
24292433
if (hw->eth->dma_dev == hw->eth->dev &&
24302434
of_dma_is_coherent(hw->eth->dev->of_node))
24312435
mtk_eth_set_dma_device(hw->eth, hw->dev);

0 commit comments

Comments
 (0)