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

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

 



On Tue, Apr 04, 2017 at 05:57:23PM -0500, Shiraz Saleem wrote:
> On Mon, Apr 03, 2017 at 01:06:31PM +0300, Leon Romanovsky wrote:
> > 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>
> > ---
> > diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> > index 9b2849979756..fb3a4ca354be 100644
> > --- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> > +++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> > @@ -1354,14 +1354,15 @@ 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;
> > +	pg_shift = region->page_shift;
> >  	for_each_sg(region->sg_head.sgl, sg, region->nmap, entry) {
> >  		chunk_pages = sg_dma_len(sg) >> pg_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);
> >
>
> Remove pg_shift local variable and use region->page_shift directly in this function.

Sure, I'm sending v1 shortly.

Thanks

> --
> 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

Attachment: signature.asc
Description: PGP signature


[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