aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ipath/ipath_qp.c
diff options
context:
space:
mode:
authorBryan O'Sullivan <bos@pathscale.com>2006-08-25 14:24:43 -0400
committerRoland Dreier <rolandd@cisco.com>2006-09-22 18:22:38 -0400
commit0b81e4f79af8322c7142701982f40d1431dedf19 (patch)
tree4d1161d8603471cbe8ece750980eb22767a91235 /drivers/infiniband/hw/ipath/ipath_qp.c
parentca4ce383acfb05b8035453cdbbfd4f8ae36c7a69 (diff)
IB/ipath: put a limit on the number of QPs that can be created
Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_qp.c')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_qp.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c
index 77391886d2f8..607ba72af2fa 100644
--- a/drivers/infiniband/hw/ipath/ipath_qp.c
+++ b/drivers/infiniband/hw/ipath/ipath_qp.c
@@ -833,9 +833,21 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
833 } 833 }
834 } 834 }
835 835
836 spin_lock(&dev->n_qps_lock);
837 if (dev->n_qps_allocated == ib_ipath_max_qps) {
838 spin_unlock(&dev->n_qps_lock);
839 ret = ERR_PTR(-ENOMEM);
840 goto bail_ip;
841 }
842
843 dev->n_qps_allocated++;
844 spin_unlock(&dev->n_qps_lock);
845
836 ret = &qp->ibqp; 846 ret = &qp->ibqp;
837 goto bail; 847 goto bail;
838 848
849bail_ip:
850 kfree(qp->ip);
839bail_rwq: 851bail_rwq:
840 vfree(qp->r_rq.wq); 852 vfree(qp->r_rq.wq);
841bail_qp: 853bail_qp:
@@ -864,6 +876,9 @@ int ipath_destroy_qp(struct ib_qp *ibqp)
864 spin_lock_irqsave(&qp->s_lock, flags); 876 spin_lock_irqsave(&qp->s_lock, flags);
865 qp->state = IB_QPS_ERR; 877 qp->state = IB_QPS_ERR;
866 spin_unlock_irqrestore(&qp->s_lock, flags); 878 spin_unlock_irqrestore(&qp->s_lock, flags);
879 spin_lock(&dev->n_qps_lock);
880 dev->n_qps_allocated--;
881 spin_unlock(&dev->n_qps_lock);
867 882
868 /* Stop the sending tasklet. */ 883 /* Stop the sending tasklet. */
869 tasklet_kill(&qp->s_task); 884 tasklet_kill(&qp->s_task);