max_recv_wr must also be non-zero for QPs which are not associated
with an SRQ.
Without this patch, if the userspace caller specifies max_recv_wr == 0
for a non-srq QP, the creation will be rejected in kernel space in
file infiniband/hw/mlx4/qp.c, function set_rq_size():
} else {
/* HW requires >= 1 RQ entry with >= 1 gather entry */
==> NOTE: if (is_user && (!cap->max_recv_wr || !cap->max_recv_sge))
return -EINVAL;
We make sure max_recv_sge is at least 1, but not max_recv_wr.
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
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;