RE: [PATCH rdma-next V1 01/10] IB: Replace ib_umem page_size by page_shift

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Artemy Kovalyov <artemyko@xxxxxxxxxxxx>
> 
> Size of pages are held by struct ib_umem in page_size field.
> 
> It is better to store it as an exponent, because page size by nature
> is always power-of-two and used as a factor, divisor or ilog2's argument.
> 
> The conversion of page_size to be page_shift allows to have portable
> code and avoid following error while compiling on ARM:
> 
>   ERROR: "__aeabi_uldivmod" [drivers/infiniband/core/ib_core.ko] undefined!
> 
> CC: Selvin Xavier <selvin.xavier@xxxxxxxxxxxx>
> CC: Steve Wise <swise@xxxxxxxxxxx>
> CC: Lijun Ou <oulijun@xxxxxxxxxx>
> CC: Shiraz Saleem <shiraz.saleem@xxxxxxxxx>
> CC: Adit Ranadive <aditr@xxxxxxxxxx>
> CC: Dennis Dalessandro <dennis.dalessandro@xxxxxxxxx>
> CC: Ram Amrani <Ram.Amrani@xxxxxxxxxx>
> Signed-off-by: Artemy Kovalyov <artemyko@xxxxxxxxxxxx>
> Signed-off-by: Leon Romanovsky <leon@xxxxxxxxxx>
> ---
> Change from v0:
>  * Remove temp variable (pg_shift) variable from i40iw driver.
> ---

...

> diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
> index 6b3bb32803bd..e741cc662606 100644
> --- a/drivers/infiniband/hw/qedr/verbs.c
> +++ b/drivers/infiniband/hw/qedr/verbs.c
> @@ -680,16 +680,16 @@ static void qedr_populate_pbls(struct qedr_dev *dev, struct ib_umem *umem,
> 
>  	pbe_cnt = 0;
> 
> -	shift = ilog2(umem->page_size);
> +	shift = umem->page_shift;
> 
>  	for_each_sg(umem->sg_head.sgl, sg, umem->nmap, entry) {
>  		pages = sg_dma_len(sg) >> shift;
>  		for (pg_cnt = 0; pg_cnt < pages; pg_cnt++) {
>  			/* store the page address in pbe */
>  			pbe->lo = cpu_to_le32(sg_dma_address(sg) +
> -					      umem->page_size * pg_cnt);
> +					      (pg_cnt << shift));
>  			addr = upper_32_bits(sg_dma_address(sg) +
> -					     umem->page_size * pg_cnt);
> +					     (pg_cnt << shift));
>  			pbe->hi = cpu_to_le32(addr);
>  			pbe_cnt++;
>  			total_num_pbes++;
> @@ -2189,7 +2189,7 @@ struct ib_mr *qedr_reg_user_mr(struct ib_pd *ibpd, u64 start, u64 len,
>  	mr->hw_mr.pbl_ptr = mr->info.pbl_table[0].pa;
>  	mr->hw_mr.pbl_two_level = mr->info.pbl_info.two_layered;
>  	mr->hw_mr.pbl_page_size_log = ilog2(mr->info.pbl_info.pbl_size);
> -	mr->hw_mr.page_size_log = ilog2(mr->umem->page_size);
> +	mr->hw_mr.page_size_log = mr->umem->page_shift;
>  	mr->hw_mr.fbo = ib_umem_offset(mr->umem);
>  	mr->hw_mr.length = len;
>  	mr->hw_mr.vaddr = usr_addr;

Acked-by: Ram Amrani <Ram.Amrani@xxxxxxxxxx>

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux