drivers/net/airoha_eth: fix packet transmission errors
authorMikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Wed, 9 Jul 2025 09:28:08 +0000 (12:28 +0300)
committerTom Rini <trini@konsulko.com>
Tue, 15 Jul 2025 15:56:01 +0000 (09:56 -0600)
commit5d49fa9e56bb0e0b085f5c794ba508349385f6b8
tree06eab03d6ceb9c49ff562cd12ae9cd4c2314879d
parent189d0b4477077f0445772d7899d8bd0a17e1f67a
drivers/net/airoha_eth: fix packet transmission errors

The dma_map_single() function calls one of the functions
  * invalidate_dcache_range(),
  * flush_dcache_range().
Both of them expect that 'vaddr' is aligned to the ARCH_DMA_MINALIGN
boundary. Unfortunately, RX/TX descriptors are 32-byte long. Thus they
might not be aligned to the ARCH_DMA_MINALIGN boundary. Data flushing
(or invalidating) might do nothing in this case.

The same applies to dma_unmap_single() function.

In the TX path case the issue might prevent package transmission (filled
TX descriptor was not flushed).

To fix an issue a special wrappers for
  * dma_map_single(),
  * dma_unmap_single()
functions were created. The patch fix flushing/invalidatiog for the
RX path as well.

The bug appears on 32-bit airoha platform, but should be present on
64-bit as well.

The code was tested both on 32-bit and 64-bit airoha boards.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
drivers/net/airoha_eth.c