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

Jack Morgenstein jackm at dev.mellanox.co.il
Mon Jun 23 06:01:32 PDT 2008


Added support for XRC receive-only QPs.
(OFED 1.3 commit 3869d6dab7e12fe452270ca641f7dd7082b42482)
    
Signed-off-by: Jack Morgenstein <jackm at dev.mellanox.co.il>

Index: libmlx4/src/mlx4.c
===================================================================
--- libmlx4.orig/src/mlx4.c	2008-06-23 09:04:50.000000000 +0300
+++ libmlx4/src/mlx4.c	2008-06-23 09:10:13.000000000 +0300
@@ -73,6 +73,11 @@ static struct ibv_xrc_ops mlx4_xrc_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
 
Index: libmlx4/src/mlx4.h
===================================================================
--- libmlx4.orig/src/mlx4.h	2008-06-23 09:04:50.000000000 +0300
+++ libmlx4/src/mlx4.h	2008-06-23 09:10:13.000000000 +0300
@@ -407,6 +407,21 @@ struct ibv_xrc_domain *mlx4_open_xrc_dom
 					    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
 
 
Index: libmlx4/src/verbs.c
===================================================================
--- libmlx4.orig/src/verbs.c	2008-06-23 09:04:50.000000000 +0300
+++ libmlx4/src/verbs.c	2008-06-23 09:10:13.000000000 +0300
@@ -770,4 +770,59 @@ int mlx4_close_xrc_domain(struct ibv_xrc
 	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



More information about the general mailing list