[ofa-general] [PATCH] libmlx4: fix adjustments for minimum qp capabilities in mlx4_create_qp

Jack Morgenstein jackm at dev.mellanox.co.il
Tue Jun 19 06:47:41 PDT 2007


Need to adjust minimum qp capability values prior to size and max resource
calculations.

Correct the rq values afterwards (as before) if have an srq.

Signed-off-by: Jack Morgenstein <jackm at dev.mellanox.co.il>

Index: new_connectx_user/src/userspace/libmlx4/src/verbs.c
===================================================================
--- new_connectx_user.orig/src/userspace/libmlx4/src/verbs.c	2007-06-18 09:33:04.000000000 +0300
+++ new_connectx_user/src/userspace/libmlx4/src/verbs.c	2007-06-19 09:47:10.000000000 +0300
@@ -355,6 +355,12 @@ struct ibv_qp *mlx4_create_qp(struct ibv
 	if (!qp)
 		return NULL;
 
+	/* adjust minimum cap values */
+	attr->cap.max_recv_wr = attr->cap.max_recv_wr ? attr->cap.max_recv_wr : 1;
+	attr->cap.max_recv_sge = attr->cap.max_recv_sge ? attr->cap.max_recv_sge : 1;
+	attr->cap.max_send_wr = attr->cap.max_send_wr ? attr->cap.max_send_wr : 1;
+	attr->cap.max_send_sge = attr->cap.max_send_sge ? attr->cap.max_send_sge : 1;
+
 	mlx4_calc_sq_wqe_size(&attr->cap, attr->qp_type, qp);
 
 	/*
@@ -366,9 +372,7 @@ struct ibv_qp *mlx4_create_qp(struct ibv
 	qp->rq.wqe_cnt = align_queue_size(attr->cap.max_recv_wr);
 
 	if (attr->srq)
-		attr->cap.max_recv_wr = qp->rq.wqe_cnt = 0;
-	else if (attr->cap.max_recv_sge < 1)
-		attr->cap.max_recv_sge = 1;
+		attr->cap.max_recv_wr = attr->cap.max_recv_sge = qp->rq.wqe_cnt = 0;
 
 	if (mlx4_alloc_qp_buf(pd, &attr->cap, attr->qp_type, qp))
 		goto err;



More information about the general mailing list