Re: [PATCH net] ethernet: ionic: Fix DMA mapping test in `ionic_xdp_post_frame()`

From: Alexander Lobakin
Date: Tue Jun 17 2025 - 11:02:11 EST


From: Thomas Fourier <fourier.thomas@xxxxxxxxx>
Date: Tue, 17 Jun 2025 11:18:36 +0200

> The `ionic_tx_map_frag()` wrapper function is used which returns 0 or a
> valid DMA address. Testing that pointer with `dma_mapping_error()`could
> be eroneous since the error value exptected by `dma_mapping_error()` is
> not 0 but `DMA_MAPPING_ERROR` which is often ~0.

BTW I remember clearly that Chris wrote that dma_addr == 0 is a
perfectly valid DMA address, that's why ~0 was picked for error checking.
So maybe it's better to fix the driver. I realize that in the real
world, it's almost impossible to get dma_addr == 0 from dma_map_*(), but
still.

>
> Fixes: ac8813c0ab7d ("ionic: convert Rx queue buffers to use page_pool")
> Signed-off-by: Thomas Fourier <fourier.thomas@xxxxxxxxx>

Thanks,
Olek