RDMA/rtrs-clt: Use the right sg_cnt after ib_dma_map_sg
authorJack Wang <jinpu.wang@ionos.com>
Thu, 18 Aug 2022 10:53:54 +0000 (12:53 +0200)
committerLeon Romanovsky <leonro@nvidia.com>
Sun, 21 Aug 2022 09:25:03 +0000 (12:25 +0300)
commitb66905e04dc714825aa6cffb950e281b46bbeafe
treeaaa6f25482bfb802a113ab8cfc90dab34444769e
parentb16de8b9e7d1aae169d059c3a0dd9a881a3c0d1d
RDMA/rtrs-clt: Use the right sg_cnt after ib_dma_map_sg

When iommu is enabled, we hit warnings like this:
WARNING: at rtrs/rtrs.c:178 rtrs_iu_post_rdma_write_imm+0x9b/0x110

rtrs warn on one sge entry length is 0, which is unexpected.

The problem is ib_dma_map_sg augments the SGL into a 'dma mapped SGL'.
This process may change the number of entries and the lengths of each
entry.

Code that touches dma_address is iterating over the 'dma mapped SGL'
and must use dma_nents which returned from ib_dma_map_sg().
So pass the count return from ib_dma_map_sg.

Fixes: 6a98d71daea1 ("RDMA/rtrs: client: main functionality")
Link: https://lore.kernel.org/r/20220818105355.110344-3-haris.iqbal@ionos.com
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
Reviewed-by: Aleksei Marov <aleksei.marov@ionos.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/ulp/rtrs/rtrs-clt.c