diff options
author | Ralph Campbell <ralph.campbell@qlogic.com> | 2008-04-17 00:09:25 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-04-17 00:09:25 -0400 |
commit | 10a8c3cd0157948ba421b3b69b89edfba6ddb4a5 (patch) | |
tree | c62b206dec3fcffd274bbdb4dbe8af2257ae2b73 /drivers | |
parent | 69bd74c6968f45a864a394338a63da4b768da6ec (diff) |
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: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_qp.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c index 9125e02eadaf..6a4a5e3b78ba 100644 --- a/drivers/infiniband/hw/ipath/ipath_qp.c +++ b/drivers/infiniband/hw/ipath/ipath_qp.c | |||
@@ -748,19 +748,25 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, | |||
748 | struct ib_qp *ret; | 748 | struct ib_qp *ret; |
749 | 749 | ||
750 | if (init_attr->cap.max_send_sge > ib_ipath_max_sges || | 750 | if (init_attr->cap.max_send_sge > ib_ipath_max_sges || |
751 | init_attr->cap.max_recv_sge > ib_ipath_max_sges || | 751 | init_attr->cap.max_send_wr > ib_ipath_max_qp_wrs) { |
752 | init_attr->cap.max_send_wr > ib_ipath_max_qp_wrs || | 752 | ret = ERR_PTR(-EINVAL); |
753 | init_attr->cap.max_recv_wr > ib_ipath_max_qp_wrs) { | ||
754 | ret = ERR_PTR(-ENOMEM); | ||
755 | goto bail; | 753 | goto bail; |
756 | } | 754 | } |
757 | 755 | ||
758 | if (init_attr->cap.max_send_sge + | 756 | /* Check receive queue parameters if no SRQ is specified. */ |
759 | init_attr->cap.max_recv_sge + | 757 | if (!init_attr->srq) { |
760 | init_attr->cap.max_send_wr + | 758 | if (init_attr->cap.max_recv_sge > ib_ipath_max_sges || |
761 | init_attr->cap.max_recv_wr == 0) { | 759 | init_attr->cap.max_recv_wr > ib_ipath_max_qp_wrs) { |
762 | ret = ERR_PTR(-EINVAL); | 760 | ret = ERR_PTR(-EINVAL); |
763 | goto bail; | 761 | goto bail; |
762 | } | ||
763 | if (init_attr->cap.max_send_sge + | ||
764 | init_attr->cap.max_send_wr + | ||
765 | init_attr->cap.max_recv_sge + | ||
766 | init_attr->cap.max_recv_wr == 0) { | ||
767 | ret = ERR_PTR(-EINVAL); | ||
768 | goto bail; | ||
769 | } | ||
764 | } | 770 | } |
765 | 771 | ||
766 | switch (init_attr->qp_type) { | 772 | switch (init_attr->qp_type) { |