RDMA/hns: Use dma_alloc_coherent() instead of kmalloc/dma_map_single()
authorCai Huoqing <caihuoqing@baidu.com>
Sun, 26 Sep 2021 06:11:15 +0000 (14:11 +0800)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 12 Oct 2021 15:54:51 +0000 (12:54 -0300)
commit9a33f3980978e420672b0b54e3fa0c7908fd7c78
treeb8190d15144c291a65499979729095e99c7d854f
parenta020094090e5293abd5c2ecdcec96a275f56c4ef
RDMA/hns: Use dma_alloc_coherent() instead of kmalloc/dma_map_single()

Replacing kmalloc/kfree/dma_map_single/dma_unmap_single() with
dma_alloc_coherent/dma_free_coherent() helps to reduce code size, and
simplify the code, and coherent DMA will not clear the cache every time.

The SOC that this driver supports does not have incoherent DMA, so this
makes the code follow the DMA API properly with no performance
impact. Currently there are missing dma sync calls around the DMA
transfers.

Link: https://lore.kernel.org/r/20210926061116.282-1-caihuoqing@baidu.com
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Reviewed-by: Wenpeng Liang <liangwenpeng@huawei.com>
Tested-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/hns/hns_roce_hw_v2.c