> 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/i40iw/i40iw_verbs.c > b/drivers/infiniband/hw/i40iw/i40iw_verbs.c > index 9b2849979756..378c75759be4 100644 > --- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c > +++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c > @@ -1345,7 +1345,7 @@ static void i40iw_copy_user_pgaddrs(struct i40iw_mr > *iwmr, { > struct ib_umem *region = iwmr->region; > struct i40iw_pbl *iwpbl = &iwmr->iwpbl; > - int chunk_pages, entry, pg_shift, i; > + int chunk_pages, entry, i; > struct i40iw_pble_alloc *palloc = &iwpbl->pble_alloc; > struct i40iw_pble_info *pinfo; > struct scatterlist *sg; > @@ -1354,14 +1354,14 @@ static void i40iw_copy_user_pgaddrs(struct i40iw_mr > *iwmr, > > pinfo = (level == I40IW_LEVEL_1) ? NULL : palloc->level2.leaf; > > - pg_shift = ffs(region->page_size) - 1; > for_each_sg(region->sg_head.sgl, sg, region->nmap, entry) { > - chunk_pages = sg_dma_len(sg) >> pg_shift; > + chunk_pages = sg_dma_len(sg) >> region->page_shift; > if ((iwmr->type == IW_MEMREG_TYPE_QP) && > !iwpbl->qp_mr.sq_page) > iwpbl->qp_mr.sq_page = sg_page(sg); > for (i = 0; i < chunk_pages; i++) { > - pg_addr = sg_dma_address(sg) + region->page_size * i; > + pg_addr = sg_dma_address(sg) + > + (i << region->page_shift); > > if ((entry + i) == 0) > *pbl = cpu_to_le64(pg_addr & iwmr->page_msk); > @@ -1847,7 +1847,7 @@ static struct ib_mr *i40iw_reg_user_mr(struct ib_pd *pd, > iwmr->ibmr.device = pd->device; > ucontext = to_ucontext(pd->uobject->context); > > - iwmr->page_size = region->page_size; > + iwmr->page_size = PAGE_SIZE; > iwmr->page_msk = PAGE_MASK; > Thank you! Acked-by: Shiraz Saleem <shiraz.saleem@xxxxxxxxx> -- 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