linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Selvin Xavier <selvin.xavier@broadcom.com>
To: dledford@redhat.com, jgg@nvidia.com
Cc: linux-rdma@vger.kernel.org
Subject: [PATCH for-next v2 05/12] RDMA/bnxt_re: Support multiple page sizes
Date: Wed, 15 Sep 2021 05:32:36 -0700	[thread overview]
Message-ID: <1631709163-2287-6-git-send-email-selvin.xavier@broadcom.com> (raw)
In-Reply-To: <1631709163-2287-1-git-send-email-selvin.xavier@broadcom.com>

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>
---
v1->v2:
	Removed the unused macros
 drivers/infiniband/hw/bnxt_re/bnxt_re.h  | 14 ++------------
 drivers/infiniband/hw/bnxt_re/ib_verbs.c |  4 ++--
 2 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/infiniband/hw/bnxt_re/bnxt_re.h b/drivers/infiniband/hw/bnxt_re/bnxt_re.h
index 5b85620..79401e6 100644
--- a/drivers/infiniband/hw/bnxt_re/bnxt_re.h
+++ b/drivers/infiniband/hw/bnxt_re/bnxt_re.h
@@ -43,19 +43,9 @@
 #define ROCE_DRV_MODULE_NAME		"bnxt_re"
 
 #define BNXT_RE_DESC	"Broadcom NetXtreme-C/E RoCE Driver"
-#define BNXT_RE_PAGE_SHIFT_4K		(12)
-#define BNXT_RE_PAGE_SHIFT_8K		(13)
-#define BNXT_RE_PAGE_SHIFT_64K		(16)
-#define BNXT_RE_PAGE_SHIFT_2M		(21)
-#define BNXT_RE_PAGE_SHIFT_8M		(23)
-#define BNXT_RE_PAGE_SHIFT_1G		(30)
 
-#define BNXT_RE_PAGE_SIZE_4K		BIT(BNXT_RE_PAGE_SHIFT_4K)
-#define BNXT_RE_PAGE_SIZE_8K		BIT(BNXT_RE_PAGE_SHIFT_8K)
-#define BNXT_RE_PAGE_SIZE_64K		BIT(BNXT_RE_PAGE_SHIFT_64K)
-#define BNXT_RE_PAGE_SIZE_2M		BIT(BNXT_RE_PAGE_SHIFT_2M)
-#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_SHIFT_1G		(30)
+#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)
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


  parent reply	other threads:[~2021-09-15 12:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-15 12:32 [PATCH for-next v2 00/12] RDMA/bnxt_re: Driver update Selvin Xavier
2021-09-15 12:32 ` [PATCH for-next v2 01/12] RDMA/bnxt_re: Add extended statistics counters Selvin Xavier
2021-09-15 12:32 ` [PATCH for-next v2 02/12] RDMA/bnxt_re: Update statistics counter name Selvin Xavier
2021-09-15 12:32 ` [PATCH for-next v2 03/12] RDMA/bnxt_re: Use separate response buffer for stat_ctx_free Selvin Xavier
2021-09-15 12:32 ` [PATCH for-next v2 04/12] RDMA/bnxt_re: Reduce the delay in polling for hwrm command completion Selvin Xavier
2021-09-15 12:32 ` Selvin Xavier [this message]
2021-09-20 13:18   ` [PATCH for-next v2 05/12] RDMA/bnxt_re: Support multiple page sizes Leon Romanovsky
2021-09-15 12:32 ` [PATCH for-next v2 06/12] RDMA/bnxt_re: Suppress unwanted error messages Selvin Xavier
2021-09-15 12:32 ` [PATCH for-next v2 07/12] RDMA/bnxt_re: Fix query SRQ failure Selvin Xavier
2021-09-20 13:19   ` Leon Romanovsky
2021-09-15 12:32 ` [PATCH for-next v2 08/12] RDMA/bnxt_re: Fix FRMR issue with single page MR allocation Selvin Xavier
2021-09-15 12:32 ` [PATCH for-next v2 09/12] RDMA/bnxt_re: Use GFP_KERNEL in non atomic context Selvin Xavier
2021-09-20 13:19   ` Leon Romanovsky
2021-09-15 12:32 ` [PATCH for-next v2 10/12] RDMA/bnxt_re: Correct FRMR size calculation Selvin Xavier
2021-09-15 12:32 ` [PATCH for-next v2 11/12] RDMA/bnxt_re: Check if the vlan is valid before reporting Selvin Xavier
2021-09-15 12:32 ` [PATCH for-next v2 12/12] MAINTAINERS: Update Broadcom RDMA maintainers Selvin Xavier
2021-09-20 16:40 ` [PATCH for-next v2 00/12] RDMA/bnxt_re: Driver update Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1631709163-2287-6-git-send-email-selvin.xavier@broadcom.com \
    --to=selvin.xavier@broadcom.com \
    --cc=dledford@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --subject='Re: [PATCH for-next v2 05/12] RDMA/bnxt_re: Support multiple page sizes' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).