Lines Matching refs:cq
51 void qib_cq_enter(struct qib_cq *cq, struct ib_wc *entry, int solicited) in qib_cq_enter() argument
58 spin_lock_irqsave(&cq->lock, flags); in qib_cq_enter()
64 wc = cq->queue; in qib_cq_enter()
66 if (head >= (unsigned) cq->ibcq.cqe) { in qib_cq_enter()
67 head = cq->ibcq.cqe; in qib_cq_enter()
72 spin_unlock_irqrestore(&cq->lock, flags); in qib_cq_enter()
73 if (cq->ibcq.event_handler) { in qib_cq_enter()
76 ev.device = cq->ibcq.device; in qib_cq_enter()
77 ev.element.cq = &cq->ibcq; in qib_cq_enter()
79 cq->ibcq.event_handler(&ev, cq->ibcq.cq_context); in qib_cq_enter()
83 if (cq->ip) { in qib_cq_enter()
105 if (cq->notify == IB_CQ_NEXT_COMP || in qib_cq_enter()
106 (cq->notify == IB_CQ_SOLICITED && in qib_cq_enter()
114 worker = cq->dd->worker; in qib_cq_enter()
116 cq->notify = IB_CQ_NONE; in qib_cq_enter()
117 cq->triggered++; in qib_cq_enter()
118 queue_kthread_work(worker, &cq->comptask); in qib_cq_enter()
122 spin_unlock_irqrestore(&cq->lock, flags); in qib_cq_enter()
138 struct qib_cq *cq = to_icq(ibcq); in qib_poll_cq() local
145 if (cq->ip) { in qib_poll_cq()
150 spin_lock_irqsave(&cq->lock, flags); in qib_poll_cq()
152 wc = cq->queue; in qib_poll_cq()
154 if (tail > (u32) cq->ibcq.cqe) in qib_poll_cq()
155 tail = (u32) cq->ibcq.cqe; in qib_poll_cq()
161 if (tail >= cq->ibcq.cqe) in qib_poll_cq()
168 spin_unlock_irqrestore(&cq->lock, flags); in qib_poll_cq()
176 struct qib_cq *cq = container_of(work, struct qib_cq, comptask); in send_complete() local
186 u8 triggered = cq->triggered; in send_complete()
195 cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context); in send_complete()
198 if (cq->triggered == triggered) in send_complete()
222 struct qib_cq *cq; in qib_create_cq() local
236 cq = kmalloc(sizeof(*cq), GFP_KERNEL); in qib_create_cq()
237 if (!cq) { in qib_create_cq()
267 cq->ip = qib_create_mmap_info(dev, sz, context, wc); in qib_create_cq()
268 if (!cq->ip) { in qib_create_cq()
273 err = ib_copy_to_udata(udata, &cq->ip->offset, in qib_create_cq()
274 sizeof(cq->ip->offset)); in qib_create_cq()
280 cq->ip = NULL; in qib_create_cq()
292 if (cq->ip) { in qib_create_cq()
294 list_add(&cq->ip->pending_mmaps, &dev->pending_mmaps); in qib_create_cq()
303 cq->dd = dd_from_dev(dev); in qib_create_cq()
304 cq->ibcq.cqe = entries; in qib_create_cq()
305 cq->notify = IB_CQ_NONE; in qib_create_cq()
306 cq->triggered = 0; in qib_create_cq()
307 spin_lock_init(&cq->lock); in qib_create_cq()
308 init_kthread_work(&cq->comptask, send_complete); in qib_create_cq()
311 cq->queue = wc; in qib_create_cq()
313 ret = &cq->ibcq; in qib_create_cq()
318 kfree(cq->ip); in qib_create_cq()
322 kfree(cq); in qib_create_cq()
338 struct qib_cq *cq = to_icq(ibcq); in qib_destroy_cq() local
340 flush_kthread_work(&cq->comptask); in qib_destroy_cq()
344 if (cq->ip) in qib_destroy_cq()
345 kref_put(&cq->ip->ref, qib_release_mmap_info); in qib_destroy_cq()
347 vfree(cq->queue); in qib_destroy_cq()
348 kfree(cq); in qib_destroy_cq()
365 struct qib_cq *cq = to_icq(ibcq); in qib_req_notify_cq() local
369 spin_lock_irqsave(&cq->lock, flags); in qib_req_notify_cq()
374 if (cq->notify != IB_CQ_NEXT_COMP) in qib_req_notify_cq()
375 cq->notify = notify_flags & IB_CQ_SOLICITED_MASK; in qib_req_notify_cq()
378 cq->queue->head != cq->queue->tail) in qib_req_notify_cq()
381 spin_unlock_irqrestore(&cq->lock, flags); in qib_req_notify_cq()
394 struct qib_cq *cq = to_icq(ibcq); in qib_resize_cq() local
429 spin_lock_irq(&cq->lock); in qib_resize_cq()
434 old_wc = cq->queue; in qib_resize_cq()
436 if (head > (u32) cq->ibcq.cqe) in qib_resize_cq()
437 head = (u32) cq->ibcq.cqe; in qib_resize_cq()
439 if (tail > (u32) cq->ibcq.cqe) in qib_resize_cq()
440 tail = (u32) cq->ibcq.cqe; in qib_resize_cq()
442 n = cq->ibcq.cqe + 1 + head - tail; in qib_resize_cq()
450 if (cq->ip) in qib_resize_cq()
454 if (tail == (u32) cq->ibcq.cqe) in qib_resize_cq()
459 cq->ibcq.cqe = cqe; in qib_resize_cq()
462 cq->queue = wc; in qib_resize_cq()
463 spin_unlock_irq(&cq->lock); in qib_resize_cq()
467 if (cq->ip) { in qib_resize_cq()
469 struct qib_mmap_info *ip = cq->ip; in qib_resize_cq()
494 spin_unlock_irq(&cq->lock); in qib_resize_cq()