[ofa-general] [PATCH] libmlx4: adjust max_recv_wr capability to be non-zero for non-SRQ qp's
Jack Morgenstein
jackm at dev.mellanox.co.il
Thu Sep 6 07:54:43 PDT 2007
max_recv_wr must also be non-zero for QPs which are not
associated with an SRQ.
Signed-off-by: Jack Morgenstein <jackm at dev.mellanox.co.il>
---
Roland,
Without this patch, if the user requested max_recv_wr = 0,
this will be passed as-is to the kernel layer.
In the kernel, the create-qp will fail because of the (correct) check in
file: drivers/infiniband/hw/mlx4/qp.c, procedure set_rq_size():
/* HW requires >= 1 RQ entry with >= 1 gather entry */
if (is_user && (!cap->max_recv_wr || !cap->max_recv_sge))
return -EINVAL;
In the patch, I added the adjustment after:
qp->rq.wqe_cnt = align_queue_size(attr->cap.max_recv_wr);
since the align_queue_size macro yields the same result for 1 as it
does for 0.
Index: libmlx4/src/verbs.c
===================================================================
--- libmlx4.orig/src/verbs.c 2007-09-06 16:29:36.000000000 +0300
+++ libmlx4/src/verbs.c 2007-09-06 16:34:55.032294000 +0300
@@ -367,8 +367,12 @@ struct ibv_qp *mlx4_create_qp(struct ibv
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;
+ else {
+ if (attr->cap.max_recv_sge < 1)
+ attr->cap.max_recv_sge = 1;
+ if (attr->cap.max_recv_wr < 1)
+ attr->cap.max_recv_wr = 1;
+ }
if (mlx4_alloc_qp_buf(pd, &attr->cap, attr->qp_type, qp))
goto err;
More information about the general
mailing list