Re: [PATCH] crypto: sa2ul: Fix DMA mapping API usage

From: Christoph Hellwig
Date: Wed Sep 23 2020 - 02:02:55 EST


On Mon, Sep 21, 2020 at 02:38:46PM +0300, Peter Ujfalusi wrote:
> Make sure that we call the dma_unmap_sg on the correct scatterlist on
> completion with the correct sg_nents.
>
> We also should be calling dma_sync_sg_for_device() on the tx buffer before
> giving it to the DMA and the dma_sync_sg_for_cpu() should be called on the
> scatterlist we received the data back.

You might want to look into using struct sg_table and the DMA mapping
helpers using it to simplify this a bit.