>Subject: Re: [PATCH v3 rdma-next 6/6] RDMA/verbs: Extend DMA block iterator >support for mixed block sizes > >On Mon, May 06, 2019 at 08:53:37AM -0500, Shiraz Saleem wrote: >> Extend the DMA block iterator for HW that can support mixed block >> sizes. A bitmap of HW supported page sizes are provided to block >> iterator which returns contiguous aligned memory blocks within a HW >> supported page size. >> >> Signed-off-by: Shiraz Saleem <shiraz.saleem@xxxxxxxxx> >> drivers/infiniband/core/verbs.c | 38 >++++++++++++++++++++++++++++++++++++-- >> include/rdma/ib_verbs.h | 18 ++++++++++++++---- >> 2 files changed, 50 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/infiniband/core/verbs.c >> b/drivers/infiniband/core/verbs.c index 3806038..fa9725d 100644 >> +++ b/drivers/infiniband/core/verbs.c >> @@ -2712,16 +2712,47 @@ int rdma_init_netdev(struct ib_device *device, >> u8 port_num, } EXPORT_SYMBOL(rdma_init_netdev); >> >> +static unsigned int rdma_find_mixed_pg_bit(struct ib_block_iter >> +*biter) { >> + if (biter->__sg == biter->__sgl_head) { >> + return rdma_find_pg_bit(sg_dma_address(biter->__sg) + >> + sg_dma_len(biter->__sg), >> + biter->pgsz_bitmap); >> + } else if (sg_is_last(biter->__sg)) { >> + return rdma_find_pg_bit(sg_dma_address(biter->__sg), >> + biter->pgsz_bitmap); >> + } else { >> + unsigned int remaining = >> + sg_dma_address(biter->__sg) + sg_dma_len(biter->__sg) >- >> + biter->__dma_addr; >> + unsigned int pg_bit = rdma_find_pg_bit(biter->__dma_addr, >> + biter->pgsz_bitmap); >> + if (remaining < BIT_ULL(biter->__pg_bit)) >> + pg_bit = rdma_find_pg_bit(remaining, >> + biter->pgsz_bitmap); > >I think this needs to follow the same basic algorithm as the single bit case, >considering the IOVA/etc. > >But there is no user, so let us just drop this patch until a user appears.. > Sure. Let's wait for a user. Updating the algo to consider IOVA is do-able. Shiraz