summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/mlx5/mem.c
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@nvidia.com>2020-10-26 16:19:35 +0300
committerJason Gunthorpe <jgg@nvidia.com>2020-11-02 21:52:26 +0300
commit7db0eea916dcc050811f7a498b4e268d764c6d24 (patch)
treedf6e01407a6a42c43a47e4cb8b71f78d01060511 /drivers/infiniband/hw/mlx5/mem.c
parent95741ee3f0f1f437720626131d866ac8dc66ab14 (diff)
downloadlinux-7db0eea916dcc050811f7a498b4e268d764c6d24.tar.xz
RDMA/mlx5: Remove ncont from mlx5_ib_cont_pages()
This is the same as ib_umem_num_dma_blocks(umem, 1UL << page_shift), have the callers compute it directly. Link: https://lore.kernel.org/r/20201026131936.1335664-7-leon@kernel.org Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/infiniband/hw/mlx5/mem.c')
-rw-r--r--drivers/infiniband/hw/mlx5/mem.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/infiniband/hw/mlx5/mem.c b/drivers/infiniband/hw/mlx5/mem.c
index 2faee44cca99..6d87f8c13ce0 100644
--- a/drivers/infiniband/hw/mlx5/mem.c
+++ b/drivers/infiniband/hw/mlx5/mem.c
@@ -41,12 +41,9 @@
* @max_page_shift: high limit for page_shift - 0 means no limit
* @count: number of PAGE_SIZE pages covered by umem
* @shift: page shift for the compound pages found in the region
- * @ncont: number of compund pages
*/
void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr,
- unsigned long max_page_shift,
- int *count, int *shift,
- int *ncont)
+ unsigned long max_page_shift, int *count, int *shift)
{
unsigned long tmp;
unsigned long m;
@@ -60,8 +57,7 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr,
struct ib_umem_odp *odp = to_ib_umem_odp(umem);
*shift = odp->page_shift;
- *ncont = ib_umem_odp_num_pages(odp);
- *count = *ncont << (*shift - PAGE_SHIFT);
+ *count = ib_umem_num_pages(umem);
return;
}
@@ -90,13 +86,10 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr,
i += len;
}
- if (i) {
+ if (i)
m = min_t(unsigned long, ilog2(roundup_pow_of_two(i)), m);
- *ncont = DIV_ROUND_UP(i, (1 << m));
- } else {
+ else
m = 0;
- *ncont = 0;
- }
*shift = PAGE_SHIFT + m;
*count = i;
}