diff options
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_cq.c')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_cq.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_cq.c b/drivers/infiniband/hw/ipath/ipath_cq.c index 392eeb394637..3efee341c9bc 100644 --- a/drivers/infiniband/hw/ipath/ipath_cq.c +++ b/drivers/infiniband/hw/ipath/ipath_cq.c | |||
@@ -158,10 +158,21 @@ struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries, | |||
158 | struct ib_ucontext *context, | 158 | struct ib_ucontext *context, |
159 | struct ib_udata *udata) | 159 | struct ib_udata *udata) |
160 | { | 160 | { |
161 | struct ipath_ibdev *dev = to_idev(ibdev); | ||
161 | struct ipath_cq *cq; | 162 | struct ipath_cq *cq; |
162 | struct ib_wc *wc; | 163 | struct ib_wc *wc; |
163 | struct ib_cq *ret; | 164 | struct ib_cq *ret; |
164 | 165 | ||
166 | if (entries > ib_ipath_max_cqes) { | ||
167 | ret = ERR_PTR(-EINVAL); | ||
168 | goto bail; | ||
169 | } | ||
170 | |||
171 | if (dev->n_cqs_allocated == ib_ipath_max_cqs) { | ||
172 | ret = ERR_PTR(-ENOMEM); | ||
173 | goto bail; | ||
174 | } | ||
175 | |||
165 | /* | 176 | /* |
166 | * Need to use vmalloc() if we want to support large #s of | 177 | * Need to use vmalloc() if we want to support large #s of |
167 | * entries. | 178 | * entries. |
@@ -197,6 +208,8 @@ struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries, | |||
197 | 208 | ||
198 | ret = &cq->ibcq; | 209 | ret = &cq->ibcq; |
199 | 210 | ||
211 | dev->n_cqs_allocated++; | ||
212 | |||
200 | bail: | 213 | bail: |
201 | return ret; | 214 | return ret; |
202 | } | 215 | } |
@@ -211,9 +224,11 @@ bail: | |||
211 | */ | 224 | */ |
212 | int ipath_destroy_cq(struct ib_cq *ibcq) | 225 | int ipath_destroy_cq(struct ib_cq *ibcq) |
213 | { | 226 | { |
227 | struct ipath_ibdev *dev = to_idev(ibcq->device); | ||
214 | struct ipath_cq *cq = to_icq(ibcq); | 228 | struct ipath_cq *cq = to_icq(ibcq); |
215 | 229 | ||
216 | tasklet_kill(&cq->comptask); | 230 | tasklet_kill(&cq->comptask); |
231 | dev->n_cqs_allocated--; | ||
217 | vfree(cq->queue); | 232 | vfree(cq->queue); |
218 | kfree(cq); | 233 | kfree(cq); |
219 | 234 | ||