Commit 10a8c3cd authored by Ralph Campbell's avatar Ralph Campbell Committed by Roland Dreier

IB/ipath: Fix sanity checks on QP number of WRs and SGEs

The receive queue number of WRs and SGEs shouldn't be checked if a
SRQ is specified.
Signed-off-by: default avatarRalph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 69bd74c6
...@@ -748,19 +748,25 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, ...@@ -748,19 +748,25 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
struct ib_qp *ret; struct ib_qp *ret;
if (init_attr->cap.max_send_sge > ib_ipath_max_sges || if (init_attr->cap.max_send_sge > ib_ipath_max_sges ||
init_attr->cap.max_recv_sge > ib_ipath_max_sges || init_attr->cap.max_send_wr > ib_ipath_max_qp_wrs) {
init_attr->cap.max_send_wr > ib_ipath_max_qp_wrs || ret = ERR_PTR(-EINVAL);
init_attr->cap.max_recv_wr > ib_ipath_max_qp_wrs) {
ret = ERR_PTR(-ENOMEM);
goto bail; goto bail;
} }
if (init_attr->cap.max_send_sge + /* Check receive queue parameters if no SRQ is specified. */
init_attr->cap.max_recv_sge + if (!init_attr->srq) {
init_attr->cap.max_send_wr + if (init_attr->cap.max_recv_sge > ib_ipath_max_sges ||
init_attr->cap.max_recv_wr == 0) { init_attr->cap.max_recv_wr > ib_ipath_max_qp_wrs) {
ret = ERR_PTR(-EINVAL); ret = ERR_PTR(-EINVAL);
goto bail; goto bail;
}
if (init_attr->cap.max_send_sge +
init_attr->cap.max_send_wr +
init_attr->cap.max_recv_sge +
init_attr->cap.max_recv_wr == 0) {
ret = ERR_PTR(-EINVAL);
goto bail;
}
} }
switch (init_attr->qp_type) { switch (init_attr->qp_type) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment