mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Abhijit Gangurde <abhijit.gangurde@amd.com>
To: <jgg@ziepe.ca>, <leon@kernel.org>
Cc: <allen.hubbe@amd.com>, <a.k@amd.com>, <nikhil.agarwal@amd.com>,
	<linux-rdma@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	"Abhijit Gangurde" <abhijit.gangurde@amd.com>
Subject: [for-next 1/3] RDMA/ionic: size the MR PTE reservation to max_sg
Date: Tue, 27 Oct 2026 14:53:51 +0530	[thread overview]
Message-ID: <20261027092353.1961552-1-abhijit.gangurde@amd.com> (raw)

From: Amit Kumar <a.k@amd.com>

CREATE_MR with map_count zero makes firmware reserve its default number
of PTEs. A fast-registration memory region (MR) whose max_sg is larger
than that default fails at REG_MR.

Pass max_sg as map_count. The virtual address (VA) and length stay zero
because no buffer is mapped yet.

Fixes: e8521822c733 ("RDMA/ionic: Register device ops for control path")
Signed-off-by: Amit Kumar <a.k@amd.com>
Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com>
---
 .../infiniband/hw/ionic/ionic_controlpath.c    | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/hw/ionic/ionic_controlpath.c b/drivers/infiniband/hw/ionic/ionic_controlpath.c
index 18ad967812f5..00f9086f3bab 100644
--- a/drivers/infiniband/hw/ionic/ionic_controlpath.c
+++ b/drivers/infiniband/hw/ionic/ionic_controlpath.c
@@ -1121,21 +1121,25 @@ struct ib_mr *ionic_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type type,
 
 	mr->flags = IONIC_MRF_PHYS_MR;
 
-	rc = ionic_pgtbl_init(dev, &mr->buf, mr->umem, 0, max_sg, PAGE_SIZE);
+	mr->buf.tbl_pages = max_sg;
+	rc = ionic_create_mr_cmd(dev, pd, mr, 0, 0);
+	if (rc)
+		goto err_cmd;
+
+	rc = ionic_pgtbl_init(dev, &mr->buf, NULL, 0, max_sg, 0);
 	if (rc)
 		goto err_pgtbl;
 
+	/* NIC reservation was already posted. tbl_pages means "mapped". */
 	mr->buf.tbl_pages = 0;
 
-	rc = ionic_create_mr_cmd(dev, pd, mr, 0, 0);
-	if (rc)
-		goto err_cmd;
-
 	return &mr->ibmr;
 
-err_cmd:
-	ionic_pgtbl_unbuf(dev, &mr->buf);
 err_pgtbl:
+	/* Keep the id if the NIC still holds the MR. */
+	if (ionic_destroy_mr_cmd(dev, mr->mrid))
+		goto err_mrid;
+err_cmd:
 	ionic_put_mrid(dev, mr->mrid);
 err_mrid:
 	kfree(mr);
-- 
2.43.0


             reply	other threads:[~2026-10-27  9:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27  9:23 Abhijit Gangurde [this message]
2026-10-27  9:23 ` [for-next 2/3] RDMA/ionic: set the SQ WQE color bit Abhijit Gangurde
2026-10-27  9:23 ` [for-next 3/3] RDMA/ionic: key recv completions by producer index Abhijit Gangurde

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=20261027092353.1961552-1-abhijit.gangurde@amd.com \
    --to=abhijit.gangurde@amd.com \
    --cc=a.k@amd.com \
    --cc=allen.hubbe@amd.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=nikhil.agarwal@amd.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®