[ofa-general] [PATCH 4/12 V2] libmlx4: XRC receive-only QP implementation

Jack Morgenstein jackm at dev.mellanox.co.il
Thu Jul 10 08:51:33 PDT 2008


From e1760ce0a30ff872db3fc066e9cf74b538bb0cb4 Mon Sep 17 00:00:00 2001
From: Jack Morgenstein <jackm at dev.mellanox.co.il>
Date: Wed, 9 Jul 2008 13:58:05 +0300
Subject: [PATCH] Added support for XRC receive-only QPs.

(OFED 1.3 commit 3869d6dab7e12fe452270ca641f7dd7082b42482)

V2:
1. xrc_ops changed to more_ops

Signed-off-by: Jack Morgenstein <jackm at dev.mellanox.co.il>
---
 src/mlx4.c  |    5 +++++
 src/mlx4.h  |   15 +++++++++++++++
 src/verbs.c |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 75 insertions(+), 0 deletions(-)

diff --git a/src/mlx4.c b/src/mlx4.c
index 8a46543..18333e7 100644
--- a/src/mlx4.c
+++ b/src/mlx4.c
@@ -73,6 +73,11 @@ static struct ibv_more_ops mlx4_more_ops = {
 	.create_xrc_srq   = mlx4_create_xrc_srq,
 	.open_xrc_domain  = mlx4_open_xrc_domain,
 	.close_xrc_domain = mlx4_close_xrc_domain,
+	.create_xrc_rcv_qp = mlx4_create_xrc_rcv_qp,
+	.modify_xrc_rcv_qp = mlx4_modify_xrc_rcv_qp,
+	.query_xrc_rcv_qp = mlx4_query_xrc_rcv_qp,
+	.reg_xrc_rcv_qp   = mlx4_reg_xrc_rcv_qp,
+	.unreg_xrc_rcv_qp = mlx4_unreg_xrc_rcv_qp,
 #endif
 };
 #endif
diff --git a/src/mlx4.h b/src/mlx4.h
index 28a8f9c..a791901 100644
--- a/src/mlx4.h
+++ b/src/mlx4.h
@@ -407,6 +407,21 @@ struct ibv_xrc_domain *mlx4_open_xrc_domain(struct ibv_context *context,
 					    int fd, int oflag);
 
 int mlx4_close_xrc_domain(struct ibv_xrc_domain *d);
+int mlx4_create_xrc_rcv_qp(struct ibv_qp_init_attr *init_attr,
+			   uint32_t *xrc_qp_num);
+int mlx4_modify_xrc_rcv_qp(struct ibv_xrc_domain *xrc_domain,
+			   uint32_t xrc_qp_num,
+			   struct ibv_qp_attr *attr,
+			   int attr_mask);
+int mlx4_query_xrc_rcv_qp(struct ibv_xrc_domain *xrc_domain,
+			  uint32_t xrc_qp_num,
+			  struct ibv_qp_attr *attr,
+			  int attr_mask,
+			  struct ibv_qp_init_attr *init_attr);
+int mlx4_reg_xrc_rcv_qp(struct ibv_xrc_domain *xrc_domain,
+			uint32_t xrc_qp_num);
+int mlx4_unreg_xrc_rcv_qp(struct ibv_xrc_domain *xrc_domain,
+			uint32_t xrc_qp_num);
 #endif
 
 
diff --git a/src/verbs.c b/src/verbs.c
index b883992..b1bad3c 100644
--- a/src/verbs.c
+++ b/src/verbs.c
@@ -770,4 +770,59 @@ int mlx4_close_xrc_domain(struct ibv_xrc_domain *d)
 	free(d);
 	return 0;
 }
+
+int mlx4_create_xrc_rcv_qp(struct ibv_qp_init_attr *init_attr,
+			   uint32_t *xrc_qp_num)
+{
+
+	return ibv_cmd_create_xrc_rcv_qp(init_attr, xrc_qp_num);
+}
+
+int mlx4_modify_xrc_rcv_qp(struct ibv_xrc_domain *xrc_domain,
+			   uint32_t xrc_qp_num,
+			   struct ibv_qp_attr *attr,
+			   int attr_mask)
+{
+	return ibv_cmd_modify_xrc_rcv_qp(xrc_domain, xrc_qp_num,
+					 attr, attr_mask);
+}
+
+int mlx4_query_xrc_rcv_qp(struct ibv_xrc_domain *xrc_domain,
+			  uint32_t xrc_qp_num,
+			  struct ibv_qp_attr *attr,
+			  int attr_mask,
+			  struct ibv_qp_init_attr *init_attr)
+{
+	int ret;
+
+	ret = ibv_cmd_query_xrc_rcv_qp(xrc_domain, xrc_qp_num,
+				       attr, attr_mask, init_attr);
+	if (ret)
+		return ret;
+
+	init_attr->cap.max_send_wr = init_attr->cap.max_send_sge = 1;
+	init_attr->cap.max_recv_sge = init_attr->cap.max_recv_wr = 0;
+	init_attr->cap.max_inline_data = 0;
+	init_attr->recv_cq = init_attr->send_cq = NULL;
+	init_attr->srq = NULL;
+	init_attr->xrc_domain = xrc_domain;
+	init_attr->qp_type = IBV_QPT_XRC;
+	init_attr->qp_context = NULL;
+	attr->cap = init_attr->cap;
+
+	return 0;
+}
+
+int mlx4_reg_xrc_rcv_qp(struct ibv_xrc_domain *xrc_domain,
+			uint32_t xrc_qp_num)
+{
+	return ibv_cmd_reg_xrc_rcv_qp(xrc_domain, xrc_qp_num);
+}
+
+int mlx4_unreg_xrc_rcv_qp(struct ibv_xrc_domain *xrc_domain,
+			  uint32_t xrc_qp_num)
+{
+	return ibv_cmd_unreg_xrc_rcv_qp(xrc_domain, xrc_qp_num);
+}
+
 #endif
-- 
1.5.1.6




More information about the general mailing list