aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_qp.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c
index 68f01513214f..a77a0dad0fa0 100644
--- a/drivers/infiniband/hw/ipath/ipath_qp.c
+++ b/drivers/infiniband/hw/ipath/ipath_qp.c
@@ -685,16 +685,22 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
685 ret = ERR_PTR(-ENOMEM); 685 ret = ERR_PTR(-ENOMEM);
686 goto bail; 686 goto bail;
687 } 687 }
688 qp->r_rq.size = init_attr->cap.max_recv_wr + 1; 688 if (init_attr->srq) {
689 sz = sizeof(struct ipath_sge) * 689 qp->r_rq.size = 0;
690 init_attr->cap.max_recv_sge + 690 qp->r_rq.max_sge = 0;
691 sizeof(struct ipath_rwqe); 691 qp->r_rq.wq = NULL;
692 qp->r_rq.wq = vmalloc(qp->r_rq.size * sz); 692 } else {
693 if (!qp->r_rq.wq) { 693 qp->r_rq.size = init_attr->cap.max_recv_wr + 1;
694 kfree(qp); 694 qp->r_rq.max_sge = init_attr->cap.max_recv_sge;
695 vfree(swq); 695 sz = (sizeof(struct ipath_sge) * qp->r_rq.max_sge) +
696 ret = ERR_PTR(-ENOMEM); 696 sizeof(struct ipath_rwqe);
697 goto bail; 697 qp->r_rq.wq = vmalloc(qp->r_rq.size * sz);
698 if (!qp->r_rq.wq) {
699 kfree(qp);
700 vfree(swq);
701 ret = ERR_PTR(-ENOMEM);
702 goto bail;
703 }
698 } 704 }
699 705
700 /* 706 /*
@@ -713,7 +719,6 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
713 qp->s_wq = swq; 719 qp->s_wq = swq;
714 qp->s_size = init_attr->cap.max_send_wr + 1; 720 qp->s_size = init_attr->cap.max_send_wr + 1;
715 qp->s_max_sge = init_attr->cap.max_send_sge; 721 qp->s_max_sge = init_attr->cap.max_send_sge;
716 qp->r_rq.max_sge = init_attr->cap.max_recv_sge;
717 qp->s_flags = init_attr->sq_sig_type == IB_SIGNAL_REQ_WR ? 722 qp->s_flags = init_attr->sq_sig_type == IB_SIGNAL_REQ_WR ?
718 1 << IPATH_S_SIGNAL_REQ_WR : 0; 723 1 << IPATH_S_SIGNAL_REQ_WR : 0;
719 dev = to_idev(ibpd->device); 724 dev = to_idev(ibpd->device);