Blame SOURCES/0001-libqedr-Set-XRC-functions-only-in-RoCE-mode.patch

3bcb62
From fd10f4c26b1ff052ea3b893247d1b6d06d01e36a Mon Sep 17 00:00:00 2001
3bcb62
From: Kamal Heib <kamalheib1@gmail.com>
3bcb62
Date: Tue, 10 Nov 2020 16:59:59 +0200
3bcb62
Subject: [PATCH] libqedr: Set XRC functions only in RoCE mode
3bcb62
3bcb62
As libqedr support both RoCE and iWarp, make sure to set the XRC
3bcb62
functions only in RoCE mode, also change the assignment of the XRC
3bcb62
functions to use verbs_set_ops().
3bcb62
3bcb62
Fixes: cae4a99ae679 ("libqedr: add support for XRC-SRQ's.")
3bcb62
Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
3bcb62
---
3bcb62
 providers/qedr/qelr_main.c | 18 ++++++++++--------
3bcb62
 1 file changed, 10 insertions(+), 8 deletions(-)
3bcb62
3bcb62
diff --git a/providers/qedr/qelr_main.c b/providers/qedr/qelr_main.c
3bcb62
index bdfaa930f0c6..e31cd452906f 100644
3bcb62
--- a/providers/qedr/qelr_main.c
3bcb62
+++ b/providers/qedr/qelr_main.c
3bcb62
@@ -113,6 +113,14 @@ static const struct verbs_context_ops qelr_ctx_ops = {
3bcb62
 	.free_context = qelr_free_context,
3bcb62
 };
3bcb62
 
3bcb62
+static const struct verbs_context_ops qelr_ctx_roce_ops = {
3bcb62
+	.close_xrcd = qelr_close_xrcd,
3bcb62
+	.create_qp_ex = qelr_create_qp_ex,
3bcb62
+	.create_srq_ex = qelr_create_srq_ex,
3bcb62
+	.get_srq_num = qelr_get_srq_num,
3bcb62
+	.open_xrcd = qelr_open_xrcd,
3bcb62
+};
3bcb62
+
3bcb62
 static void qelr_uninit_device(struct verbs_device *verbs_device)
3bcb62
 {
3bcb62
 	struct qelr_device *dev = get_qelr_dev(&verbs_device->device);
3bcb62
@@ -171,7 +179,6 @@ static struct verbs_context *qelr_alloc_context(struct ibv_device *ibdev,
3bcb62
 						int cmd_fd,
3bcb62
 						void *private_data)
3bcb62
 {
3bcb62
-	struct verbs_context *v_ctx;
3bcb62
 	struct qelr_devctx *ctx;
3bcb62
 	struct qelr_alloc_context cmd = {};
3bcb62
 	struct qelr_alloc_context_resp resp;
3bcb62
@@ -181,7 +188,6 @@ static struct verbs_context *qelr_alloc_context(struct ibv_device *ibdev,
3bcb62
 	if (!ctx)
3bcb62
 		return NULL;
3bcb62
 
3bcb62
-	v_ctx = &ctx->ibv_ctx;
3bcb62
 	memset(&resp, 0, sizeof(resp));
3bcb62
 
3bcb62
 	qelr_open_debug_file(ctx);
3bcb62
@@ -194,6 +200,8 @@ static struct verbs_context *qelr_alloc_context(struct ibv_device *ibdev,
3bcb62
 		goto cmd_err;
3bcb62
 
3bcb62
 	verbs_set_ops(&ctx->ibv_ctx, &qelr_ctx_ops);
3bcb62
+	if (IS_ROCE(ibdev))
3bcb62
+		verbs_set_ops(&ctx->ibv_ctx, &qelr_ctx_roce_ops);
3bcb62
 
3bcb62
 	ctx->srq_table = calloc(QELR_MAX_SRQ_ID, sizeof(*ctx->srq_table));
3bcb62
 	if (!ctx->srq_table) {
3bcb62
@@ -252,12 +260,6 @@ static struct verbs_context *qelr_alloc_context(struct ibv_device *ibdev,
3bcb62
 		goto cmd_err;
3bcb62
 	}
3bcb62
 
3bcb62
-	v_ctx->create_qp_ex = qelr_create_qp_ex;
3bcb62
-	v_ctx->open_xrcd = qelr_open_xrcd;
3bcb62
-	v_ctx->close_xrcd = qelr_close_xrcd;
3bcb62
-	v_ctx->create_srq_ex = qelr_create_srq_ex;
3bcb62
-	v_ctx->get_srq_num = qelr_get_srq_num;
3bcb62
-
3bcb62
 	return &ctx->ibv_ctx;
3bcb62
 
3bcb62
 cmd_err:
3bcb62
-- 
3bcb62
2.25.4
3bcb62