linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bob Pearson <rpearsonhpe@gmail.com>
To: jgg@nvidia.com, xyjxyj2000@gmail.com, linux-rdma@vger.kernel.org
Cc: Bob Pearson <rpearsonhpe@gmail.com>
Subject: [PATCH 2/5] Providers/rxe: Support alloc/dealloc xrcd
Date: Fri, 30 Jul 2021 10:21:55 -0500	[thread overview]
Message-ID: <20210730152157.67592-3-rpearsonhpe@gmail.com> (raw)
In-Reply-To: <20210730152157.67592-1-rpearsonhpe@gmail.com>

Add support for ibv_alloc_xrcd and ibv_dealloc_xrcd verbs.

Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
---
 providers/rxe/rxe.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/providers/rxe/rxe.c b/providers/rxe/rxe.c
index 0776279c..3bb9f01c 100644
--- a/providers/rxe/rxe.c
+++ b/providers/rxe/rxe.c
@@ -128,6 +128,44 @@ static int rxe_dealloc_pd(struct ibv_pd *pd)
 	return ret;
 }
 
+static struct ibv_xrcd *rxe_open_xrcd(struct ibv_context *context,
+					struct ibv_xrcd_init_attr *attr)
+{
+	struct verbs_xrcd *xrcd;
+	int xrcd_size = sizeof(*xrcd);
+	struct ibv_open_xrcd cmd = {};
+	size_t cmd_size = sizeof(cmd);
+	struct ib_uverbs_open_xrcd_resp resp = {};
+	size_t resp_size = sizeof(resp);
+	int ret;
+
+	xrcd = calloc(1, sizeof(*xrcd));
+	if (!xrcd)
+		return NULL;
+
+	ret = ibv_cmd_open_xrcd(context, xrcd, xrcd_size, attr,
+				&cmd, cmd_size, &resp, resp_size);
+	if (ret) {
+		free(xrcd);
+		return NULL;
+	}
+
+	return &xrcd->xrcd;
+}
+
+static int rxe_close_xrcd(struct ibv_xrcd *ibxrcd)
+{
+	struct verbs_xrcd *xrcd = container_of(ibxrcd,
+					struct verbs_xrcd, xrcd);
+	int ret;
+
+	ret = ibv_cmd_close_xrcd(xrcd);
+	if (!ret)
+		free(xrcd);
+
+	return ret;
+}
+
 static struct ibv_mw *rxe_alloc_mw(struct ibv_pd *ibpd, enum ibv_mw_type type)
 {
 	int ret;
@@ -1742,6 +1780,8 @@ static const struct verbs_context_ops rxe_ctx_ops = {
 	.query_port = rxe_query_port,
 	.alloc_pd = rxe_alloc_pd,
 	.dealloc_pd = rxe_dealloc_pd,
+	.open_xrcd = rxe_open_xrcd,
+	.close_xrcd = rxe_close_xrcd,
 	.reg_mr = rxe_reg_mr,
 	.dereg_mr = rxe_dereg_mr,
 	.alloc_mw = rxe_alloc_mw,
-- 
2.30.2


  parent reply	other threads:[~2021-07-30 15:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-30 15:21 [PATCH 0/5] Providers/rxe: Implement XRC transport for rxe Bob Pearson
2021-07-30 15:21 ` [PATCH 1/5] Update kernel headers Bob Pearson
2021-07-30 15:21 ` Bob Pearson [this message]
2021-07-30 15:21 ` [PATCH 3/5] Providers/rxe: Support extended create srq Bob Pearson
2021-07-30 15:21 ` [PATCH 4/5] Providers/rxe: Support get srq number Bob Pearson
2021-07-30 15:21 ` [PATCH 5/5] Providers/rxe: Support XRC traffic Bob Pearson
2021-08-02  8:30   ` Leon Romanovsky
2021-08-13 21:39     ` Bob Pearson

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=20210730152157.67592-3-rpearsonhpe@gmail.com \
    --to=rpearsonhpe@gmail.com \
    --cc=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=xyjxyj2000@gmail.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;
as well as URLs for NNTP newsgroup(s).