Re: [PATCH][linux-next] net: enetc: unmap DMA in enetc_send_cmd()

From: Jakub Kicinski
Date: Wed Oct 20 2021 - 18:23:17 EST


On Tue, 19 Oct 2021 19:47:17 +0000 Claudiu Manoil wrote:
> > I am curious why you do not need to call dma_sync_single_for_device()
> > before enetc_send_cmd()
> > in order to flush the contents of CPU cache to RAM. Is it because
> > __GFP_DMA marks
> > that page as uncached ? Or is it because of the SOC this runs on ?
> >
>
> Not sure how it works like this, but I think dma_alloc_coherent() should have
> been used here instead of the kmalloc + dma_map scheme.

Using dma_alloc_coherent() seems simpler and more correct,
let's do that instead.