[ofa-general] [PATCH 1/2] libmlx4: pass more data from user to kernel

Eli Cohen eli at mellanox.co.il
Thu May 17 00:32:37 PDT 2007


Pass to kernel user calcuated values which will be used by the kernel to
configure the qp and pin memory.

Signed-off-by: Eli Cohen <eli at mellanox.co.il>

---

Index: libmlx4/src/mlx4-abi.h
===================================================================
--- libmlx4.orig/src/mlx4-abi.h	2007-05-16 16:37:01.000000000 +0300
+++ libmlx4/src/mlx4-abi.h	2007-05-17 09:46:56.000000000 +0300
@@ -35,7 +35,7 @@
 
 #include <infiniband/kern-abi.h>
 
-#define MLX4_UVERBS_ABI_VERSION	1
+#define MLX4_UVERBS_ABI_VERSION	2
 
 struct mlx4_alloc_ucontext_resp {
 	struct ibv_get_context_resp	ibv_resp;
@@ -83,6 +83,10 @@ struct mlx4_create_qp {
 	struct ibv_create_qp		ibv_cmd;
 	__u64				buf_addr;
 	__u64				db_addr;
+	__u64				rq_size;
+	__u64				sq_size;
+	__u8				rcv_wqe_shift;
+	__u8				log_wqe_bb;
 };
 
 #endif /* MLX4_ABI_H */
Index: libmlx4/src/verbs.c
===================================================================
--- libmlx4.orig/src/verbs.c	2007-05-16 16:37:01.000000000 +0300
+++ libmlx4/src/verbs.c	2007-05-17 09:37:46.000000000 +0300
@@ -385,6 +385,11 @@ struct ibv_qp *mlx4_create_qp(struct ibv
 
 	cmd.buf_addr = (uintptr_t) qp->buf.buf;
 	cmd.db_addr  = (uintptr_t) qp->db;
+	cmd.rq_size = (uintptr_t) qp->rq.max;
+	cmd.sq_size = (uintptr_t) qp->sq.max;
+	cmd.rcv_wqe_shift = qp->rq.wqe_shift;
+	cmd.log_wqe_bb = qp->sq.wqe_shift;
+	qp->max_inline_data = attr->cap.max_inline_data;
 
 	ret = ibv_cmd_create_qp(pd, &qp->ibv_qp, attr, &cmd.ibv_cmd, sizeof cmd,
 				&resp, sizeof resp);
@@ -395,12 +400,6 @@ struct ibv_qp *mlx4_create_qp(struct ibv
 	if (ret)
 		goto err_destroy;
 
-	qp->sq.max	    = attr->cap.max_send_wr;
-	qp->rq.max	    = attr->cap.max_recv_wr;
-	qp->sq.max_gs	    = attr->cap.max_send_sge;
-	qp->rq.max_gs	    = attr->cap.max_recv_sge;
-	qp->max_inline_data = attr->cap.max_inline_data;
-
 	qp->doorbell_qpn    = htonl(qp->ibv_qp.qp_num << 8);
 	if (attr->sq_sig_all)
 		qp->sq_signal_bits = htonl(MLX4_WQE_CTRL_CQ_UPDATE);




More information about the general mailing list