1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Fri, 8 Apr 2022 10:59:45 +0200
3 Subject: [PATCH] net: ethernet: mtk_eth_soc/wed: fix sparse endian warnings
5 Descriptor fields are little-endian
7 Fixes: 804775dfc288 ("net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED)")
8 Reported-by: kernel test robot <lkp@intel.com>
9 Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 Signed-off-by: David S. Miller <davem@davemloft.net>
13 --- a/drivers/net/ethernet/mediatek/mtk_wed.c
14 +++ b/drivers/net/ethernet/mediatek/mtk_wed.c
15 @@ -144,16 +144,17 @@ mtk_wed_buffer_alloc(struct mtk_wed_devi
17 for (s = 0; s < MTK_WED_BUF_PER_PAGE; s++) {
21 txd_size = dev->wlan.init_buf(buf, buf_phys, token++);
23 - desc->buf0 = buf_phys;
24 - desc->buf1 = buf_phys + txd_size;
25 - desc->ctrl = FIELD_PREP(MTK_WDMA_DESC_CTRL_LEN0,
27 - FIELD_PREP(MTK_WDMA_DESC_CTRL_LEN1,
28 - MTK_WED_BUF_SIZE - txd_size) |
29 - MTK_WDMA_DESC_CTRL_LAST_SEG1;
30 + desc->buf0 = cpu_to_le32(buf_phys);
31 + desc->buf1 = cpu_to_le32(buf_phys + txd_size);
32 + ctrl = FIELD_PREP(MTK_WDMA_DESC_CTRL_LEN0, txd_size) |
33 + FIELD_PREP(MTK_WDMA_DESC_CTRL_LEN1,
34 + MTK_WED_BUF_SIZE - txd_size) |
35 + MTK_WDMA_DESC_CTRL_LAST_SEG1;
36 + desc->ctrl = cpu_to_le32(ctrl);
40 @@ -184,12 +185,14 @@ mtk_wed_free_buffer(struct mtk_wed_devic
42 for (i = 0, page_idx = 0; i < dev->buf_ring.size; i += MTK_WED_BUF_PER_PAGE) {
43 void *page = page_list[page_idx++];
44 + dma_addr_t buf_addr;
49 - dma_unmap_page(dev->hw->dev, desc[i].buf0,
50 - PAGE_SIZE, DMA_BIDIRECTIONAL);
51 + buf_addr = le32_to_cpu(desc[i].buf0);
52 + dma_unmap_page(dev->hw->dev, buf_addr, PAGE_SIZE,