RDMA/mlx5: Use ib_umem_find_best_pgsz() for devx
authorJason Gunthorpe <jgg@nvidia.com>
Sun, 15 Nov 2020 11:43:10 +0000 (13:43 +0200)
committerJason Gunthorpe <jgg@nvidia.com>
Mon, 16 Nov 2020 20:53:30 +0000 (16:53 -0400)
commit878f7b31c3a7f3e48c6601ea373b8688e7e308e0
tree4948e75a38525539351e738e9d6cd144fb0f14d6
parentc08fbdc57741026a440d01593e09e11b60b3e210
RDMA/mlx5: Use ib_umem_find_best_pgsz() for devx

Since devx uses the new rdma_for_each_block() to fill the PAS it can also
use ib_umem_find_best_pgsz().

However, the umem constructionin devx is complicated, the umem must still
respect all the HW limits such as page_offset_quantized and the IOVA
alignment.

Since we don't know what the user intends to use the umem for we have to
limit it to PAGE_SIZE.

There are users trying to mix umem's with mkeys so this makes them work
reliably, at least for an identity IOVA, by ensuring the IOVA matches the
selected page size.

Last user of mlx5_ib_get_buf_offset() so it can also be removed.

Fixes: aeae94579caf ("IB/mlx5: Add DEVX support for memory registration")
Link: https://lore.kernel.org/r/20201115114311.136250-7-leon@kernel.org
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/mlx5/devx.c
drivers/infiniband/hw/mlx5/mem.c
drivers/infiniband/hw/mlx5/mlx5_ib.h