8f3dfe82399f82681869fb509556427332689754
[openwrt/staging/xback.git] /
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
4
5 Descriptor fields are little-endian
6
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>
11 ---
12
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
16
17 for (s = 0; s < MTK_WED_BUF_PER_PAGE; s++) {
18 u32 txd_size;
19 + u32 ctrl;
20
21 txd_size = dev->wlan.init_buf(buf, buf_phys, token++);
22
23 - desc->buf0 = buf_phys;
24 - desc->buf1 = buf_phys + txd_size;
25 - desc->ctrl = FIELD_PREP(MTK_WDMA_DESC_CTRL_LEN0,
26 - txd_size) |
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);
37 desc->info = 0;
38 desc++;
39
40 @@ -184,12 +185,14 @@ mtk_wed_free_buffer(struct mtk_wed_devic
41
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;
45
46 if (!page)
47 break;
48
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,
53 + DMA_BIDIRECTIONAL);
54 __free_page(page);
55 }
56