public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Devesh Sharma
	<devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	Sriharsha Basavapatna
	<sriharsha.basavapatna-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	Somnath Kotur
	<somnath.kotur-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	Selvin Xavier
	<selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
Subject: [PATCH rdma-core 02/11] libbnxtre: Add support for user memory regions
Date: Sat, 28 Jan 2017 17:13:33 -0500	[thread overview]
Message-ID: <1485641622-30015-3-git-send-email-devesh.sharma@broadcom.com> (raw)
In-Reply-To: <1485641622-30015-1-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>

This patch adds code to allow user applications to register and
unregister memory buffers with the HCA. Following functions are
now supported:
 - ibv_reg_mr()
 - ibv_dereg_mr()

Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
Signed-off-by: Somnath Kotur <somnath.kotur-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
Signed-off-by: Selvin Xavier <selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
Signed-off-by: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
---
 providers/bnxtre/abi.h   |  4 ++++
 providers/bnxtre/verbs.c | 26 ++++++++++++++++++++++++--
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/providers/bnxtre/abi.h b/providers/bnxtre/abi.h
index 653ac71..0568d67 100644
--- a/providers/bnxtre/abi.h
+++ b/providers/bnxtre/abi.h
@@ -56,4 +56,8 @@ struct bnxt_re_pd_resp {
 	__u64 dbr;
 };
 
+struct bnxt_re_mr_resp {
+	struct ibv_reg_mr_resp resp;
+};
+
 #endif
diff --git a/providers/bnxtre/verbs.c b/providers/bnxtre/verbs.c
index ab1a453..9813db8 100644
--- a/providers/bnxtre/verbs.c
+++ b/providers/bnxtre/verbs.c
@@ -134,12 +134,34 @@ int bnxt_re_free_pd(struct ibv_pd *ibvpd)
 struct ibv_mr *bnxt_re_reg_mr(struct ibv_pd *ibvpd, void *sva, size_t len,
 			      int access)
 {
-	return NULL;
+	struct bnxt_re_mr *mr;
+	struct ibv_reg_mr cmd;
+	struct bnxt_re_mr_resp resp;
+
+	mr = calloc(1, sizeof(*mr));
+	if (!mr)
+		return NULL;
+
+	if (ibv_cmd_reg_mr(ibvpd, sva, len, (uint64_t)sva, access, &mr->ibvmr,
+			   &cmd, sizeof(cmd), &resp.resp, sizeof(resp))) {
+		free(mr);
+		return NULL;
+	}
+
+	return &mr->ibvmr;
 }
 
 int bnxt_re_dereg_mr(struct ibv_mr *ibvmr)
 {
-	return -ENOSYS;
+	struct bnxt_re_mr *mr = (struct bnxt_re_mr *)ibvmr;
+	int status;
+
+	status = ibv_cmd_dereg_mr(ibvmr);
+	if (status)
+		return status;
+	free(mr);
+
+	return 0;
 }
 
 struct ibv_cq *bnxt_re_create_cq(struct ibv_context *ibvctx, int ncqe,
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-01-28 22:13 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-28 22:13 [PATCH rdma-core 00/11] Broadcom User Space RoCE Driver Devesh Sharma
     [not found] ` <1485641622-30015-1-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-01-28 22:13   ` [PATCH rdma-core 01/11] libbnxtre: introduce bnxtre user space RDMA provider Devesh Sharma
     [not found]     ` <1485641622-30015-2-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-01-29  7:25       ` Leon Romanovsky
2017-01-29 23:05       ` Jason Gunthorpe
2017-01-28 22:13   ` Devesh Sharma [this message]
2017-01-28 22:13   ` [PATCH rdma-core 03/11] libbnxtre: Add support for CQ and QP management Devesh Sharma
     [not found]     ` <1485641622-30015-4-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-01-29 23:07       ` Jason Gunthorpe
2017-01-30  7:16       ` Leon Romanovsky
2017-01-28 22:13   ` [PATCH rdma-core 04/11] libbnxtre: Add support for posting and polling Devesh Sharma
     [not found]     ` <1485641622-30015-5-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-01-29 23:43       ` Jason Gunthorpe
     [not found]         ` <20170129234338.GG24051-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-01-30  6:43           ` Leon Romanovsky
2017-01-30  6:59       ` Leon Romanovsky
2017-01-28 22:13   ` [PATCH rdma-core 05/11] libbnxtre: Allow apps to poll for flushed completions Devesh Sharma
     [not found]     ` <1485641622-30015-6-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-01-29 23:11       ` Jason Gunthorpe
2017-01-28 22:13   ` [PATCH rdma-core 06/11] libbnxtre: convert cpu to le all over the place Devesh Sharma
     [not found]     ` <1485641622-30015-7-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-01-29  7:09       ` Leon Romanovsky
2017-01-29 23:09       ` Jason Gunthorpe
2017-01-28 22:13   ` [PATCH rdma-core 07/11] libbnxtre: Enable UD control path and wqe posting Devesh Sharma
2017-01-28 22:13   ` [PATCH rdma-core 08/11] libbnxtre: Enable polling for UD completions Devesh Sharma
2017-01-28 22:13   ` [PATCH rdma-core 09/11] libbnxtre: Add support for atomic operations Devesh Sharma
     [not found]     ` <1485641622-30015-10-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-01-29 23:46       ` Jason Gunthorpe
2017-01-30  6:37       ` Leon Romanovsky
2017-01-28 22:13   ` [PATCH rdma-core 10/11] libbnxtre: Add support for SRQ in user lib Devesh Sharma
     [not found]     ` <1485641622-30015-11-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-01-31 12:42       ` Leon Romanovsky
2017-01-28 22:13   ` [PATCH rdma-core 11/11] libbnxtre: Add versioning support Devesh Sharma
     [not found]     ` <1485641622-30015-12-git-send-email-devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-01-29  7:17       ` Leon Romanovsky
2017-01-29 23:40       ` Jason Gunthorpe
2017-01-29  2:24   ` [PATCH rdma-core 00/11] Broadcom User Space RoCE Driver Doug Ledford
2017-01-29 22:56   ` Jason Gunthorpe
     [not found]     ` <20170129225625.GA24051-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-02-08 11:38       ` Devesh Sharma

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=1485641622-30015-3-git-send-email-devesh.sharma@broadcom.com \
    --to=devesh.sharma-dy08kvg/lbpwk0htik3j/w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=somnath.kotur-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=sriharsha.basavapatna-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    /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