Re: [PATCH rdma-next v1 4/6] RDMA/i40iw: Use umem API to retrieve aligned DMA address

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

 



On Tue, Feb 19, 2019 at 08:57:43AM -0600, Shiraz Saleem wrote:
> Call the core helpers to retrieve the HW aligned address to use
> for the MR, within a supported i40iw page size.
> 
> Remove code in i40iw to determine when MR is backed by 2M huge pages
> which involves checking the umem->hugetlb flag and VMA inspection.
> The core helpers will return the 2M aligned address if the
> MR is backed by 2M pages.
> 
> Fixes: f26c7c83395b ("i40iw: Add 2MB page support")
> Reviewed-by: Michael J. Ruhl <michael.j.ruhl@xxxxxxxxx>
> Signed-off-by: Shiraz Saleem <shiraz.saleem@xxxxxxxxx>
>  drivers/infiniband/hw/i40iw/i40iw_user.h  |  5 ++++
>  drivers/infiniband/hw/i40iw/i40iw_verbs.c | 49 ++++++-------------------------
>  drivers/infiniband/hw/i40iw/i40iw_verbs.h |  3 +-
>  3 files changed, 15 insertions(+), 42 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/i40iw/i40iw_user.h b/drivers/infiniband/hw/i40iw/i40iw_user.h
> index b125925..09fdcee 100644
> +++ b/drivers/infiniband/hw/i40iw/i40iw_user.h
> @@ -80,6 +80,11 @@ enum i40iw_device_capabilities_const {
>  	I40IW_MAX_PDS = 			32768
>  };
>  
> +enum i40iw_supported_page_size {
> +	I40IW_PAGE_SZ_4K = 0x00001000,
> +	I40IW_PAGE_SZ_2M = 0x00200000
> +};

This seems a bit strange..

> -	for_each_sg_dma_page (region->sg_head.sgl, &sg_iter, region->nmap, 0) {
> -		pg_addr = sg_page_iter_dma_address(&sg_iter);
> -		if (first_pg)
> -			*pbl = cpu_to_le64(pg_addr & iwmr->page_msk);
> -		else if (!(pg_addr & ~iwmr->page_msk))
> -			*pbl = cpu_to_le64(pg_addr);
> -		else
> -			continue;
> -
> -		first_pg = false;
> +	for (ib_umem_start_phys_iter(region, &sg_phys_iter,
> -		iwmr->page_size);

Maybe this should be:

for_each_sg_dma_page_sz (region->sg_head.sgl, &sg_iter, region->nmap,
                         iwmr->page_size) 

?

Is there a reason to move away from the API we built here?

Jason



[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