This patch set is aiming to allow drivers that support multiple page sizes to leverage the core umem APIs to obtain suitable HW DMA addresses for the MR, aligned to a supported page size. The APIs accomodates for HW that support single page size or mixed page sizes in an MR. The motivation for this work comes from the discussion in [1]. The first patch modifies current memory registration API ib_umem_get() to build a minimal SG table where each SG entry contain the largest contiguous regions possible. One concern here is whether it is ok to temporarily reserve memory for the array of npage struct page pointers. The second patch introduces a core API that allows drivers to find the best supported page size to use for this MR, from a bitmap of HW supported page sizes. The third patch introduces core APIs that iterates through the SG list and returns suitable HW DMA addresses aligned to a driver supported page size. The fourth patch uses the new core APIs in i40iw to get optimal HW addresses to use for the MR. The use of umem->hugetlb flag and VMA inspection for determining if MR is backed by huge pages is also removed from i40iw. Please note that mixed page portion of the algorithm has not been tested on hardware. The APIs are currently been tested with i40iw hardware. [1] https://patchwork.kernel.org/patch/10499753/ Shiraz Saleem (4): RDMA/umem: Minimize SG table entries RDMA/umem: Add API to find best driver supported page size in an MR RDMA/umem: Add API to return optimal HW DMA addresses from SG list RDMA/i40iw: Use umem APIs to retrieve optimal HW address drivers/infiniband/core/umem.c | 229 +++++++++++++++++++++++++----- drivers/infiniband/hw/i40iw/i40iw_user.h | 5 + drivers/infiniband/hw/i40iw/i40iw_verbs.c | 58 ++------ include/rdma/ib_umem.h | 26 ++++ 4 files changed, 237 insertions(+), 81 deletions(-) -- 2.8.3