diff mbox series

[for-next,05/12] RDMA/bnxt_re: Support multiple page sizes

Message ID 1631470526-22228-6-git-send-email-selvin.xavier@broadcom.com (mailing list archive)
State Superseded
Delegated to: Leon Romanovsky
Headers show
Series RDMA/bnxt_re: Driver update | expand

Commit Message

Selvin Xavier Sept. 12, 2021, 6:15 p.m. UTC
HW can support multiple page sizes. Enable bits
for enabling sizes from 4k to 1G by reporting
page_size_cap.

Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
---
 drivers/infiniband/hw/bnxt_re/bnxt_re.h  | 2 ++
 drivers/infiniband/hw/bnxt_re/ib_verbs.c | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

Comments

Leon Romanovsky Sept. 13, 2021, 10:51 a.m. UTC | #1
On Sun, Sep 12, 2021 at 11:15:19AM -0700, Selvin Xavier wrote:
> HW can support multiple page sizes. Enable bits
> for enabling sizes from 4k to 1G by reporting
> page_size_cap.
> 
> Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
> ---
>  drivers/infiniband/hw/bnxt_re/bnxt_re.h  | 2 ++
>  drivers/infiniband/hw/bnxt_re/ib_verbs.c | 4 ++--
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/bnxt_re/bnxt_re.h b/drivers/infiniband/hw/bnxt_re/bnxt_re.h
> index 5b85620..39a5677 100644
> --- a/drivers/infiniband/hw/bnxt_re/bnxt_re.h
> +++ b/drivers/infiniband/hw/bnxt_re/bnxt_re.h
> @@ -57,6 +57,8 @@
>  #define BNXT_RE_PAGE_SIZE_8M		BIT(BNXT_RE_PAGE_SHIFT_8M)
>  #define BNXT_RE_PAGE_SIZE_1G		BIT(BNXT_RE_PAGE_SHIFT_1G)

All the defines above can be deleted, they are not used.

>  
> +#define BNXT_RE_PAGE_SIZE_SUPPORTED	0x7FFFF000 /* 4kb - 1G */
> +
>  #define BNXT_RE_MAX_MR_SIZE_LOW		BIT_ULL(BNXT_RE_PAGE_SHIFT_1G)
>  #define BNXT_RE_MAX_MR_SIZE_HIGH	BIT_ULL(39)
>  #define BNXT_RE_MAX_MR_SIZE		BNXT_RE_MAX_MR_SIZE_HIGH
> diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> index 22e3668..c4d7a9e 100644
> --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> @@ -133,7 +133,7 @@ int bnxt_re_query_device(struct ib_device *ibdev,
>  	bnxt_qplib_get_guid(rdev->netdev->dev_addr,
>  			    (u8 *)&ib_attr->sys_image_guid);
>  	ib_attr->max_mr_size = BNXT_RE_MAX_MR_SIZE;
> -	ib_attr->page_size_cap = BNXT_RE_PAGE_SIZE_4K | BNXT_RE_PAGE_SIZE_2M;
> +	ib_attr->page_size_cap = BNXT_RE_PAGE_SIZE_SUPPORTED;
>  
>  	ib_attr->vendor_id = rdev->en_dev->pdev->vendor;
>  	ib_attr->vendor_part_id = rdev->en_dev->pdev->device;
> @@ -3807,7 +3807,7 @@ struct ib_mr *bnxt_re_reg_user_mr(struct ib_pd *ib_pd, u64 start, u64 length,
>  
>  	mr->qplib_mr.va = virt_addr;
>  	page_size = ib_umem_find_best_pgsz(
> -		umem, BNXT_RE_PAGE_SIZE_4K | BNXT_RE_PAGE_SIZE_2M, virt_addr);
> +		umem, BNXT_RE_PAGE_SIZE_SUPPORTED, virt_addr);
>  	if (!page_size) {
>  		ibdev_err(&rdev->ibdev, "umem page size unsupported!");
>  		rc = -EFAULT;
> -- 
> 2.5.5
>
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/bnxt_re/bnxt_re.h b/drivers/infiniband/hw/bnxt_re/bnxt_re.h
index 5b85620..39a5677 100644
--- a/drivers/infiniband/hw/bnxt_re/bnxt_re.h
+++ b/drivers/infiniband/hw/bnxt_re/bnxt_re.h
@@ -57,6 +57,8 @@ 
 #define BNXT_RE_PAGE_SIZE_8M		BIT(BNXT_RE_PAGE_SHIFT_8M)
 #define BNXT_RE_PAGE_SIZE_1G		BIT(BNXT_RE_PAGE_SHIFT_1G)
 
+#define BNXT_RE_PAGE_SIZE_SUPPORTED	0x7FFFF000 /* 4kb - 1G */
+
 #define BNXT_RE_MAX_MR_SIZE_LOW		BIT_ULL(BNXT_RE_PAGE_SHIFT_1G)
 #define BNXT_RE_MAX_MR_SIZE_HIGH	BIT_ULL(39)
 #define BNXT_RE_MAX_MR_SIZE		BNXT_RE_MAX_MR_SIZE_HIGH
diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
index 22e3668..c4d7a9e 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
@@ -133,7 +133,7 @@  int bnxt_re_query_device(struct ib_device *ibdev,
 	bnxt_qplib_get_guid(rdev->netdev->dev_addr,
 			    (u8 *)&ib_attr->sys_image_guid);
 	ib_attr->max_mr_size = BNXT_RE_MAX_MR_SIZE;
-	ib_attr->page_size_cap = BNXT_RE_PAGE_SIZE_4K | BNXT_RE_PAGE_SIZE_2M;
+	ib_attr->page_size_cap = BNXT_RE_PAGE_SIZE_SUPPORTED;
 
 	ib_attr->vendor_id = rdev->en_dev->pdev->vendor;
 	ib_attr->vendor_part_id = rdev->en_dev->pdev->device;
@@ -3807,7 +3807,7 @@  struct ib_mr *bnxt_re_reg_user_mr(struct ib_pd *ib_pd, u64 start, u64 length,
 
 	mr->qplib_mr.va = virt_addr;
 	page_size = ib_umem_find_best_pgsz(
-		umem, BNXT_RE_PAGE_SIZE_4K | BNXT_RE_PAGE_SIZE_2M, virt_addr);
+		umem, BNXT_RE_PAGE_SIZE_SUPPORTED, virt_addr);
 	if (!page_size) {
 		ibdev_err(&rdev->ibdev, "umem page size unsupported!");
 		rc = -EFAULT;