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()
220 struct qib_cq *cq; in qib_create_cq() local
231 cq = kmalloc(sizeof(*cq), GFP_KERNEL); in qib_create_cq()
232 if (!cq) { in qib_create_cq()
262 cq->ip = qib_create_mmap_info(dev, sz, context, wc); in qib_create_cq()
263 if (!cq->ip) { in qib_create_cq()
268 err = ib_copy_to_udata(udata, &cq->ip->offset, in qib_create_cq()
269 sizeof(cq->ip->offset)); in qib_create_cq()
275 cq->ip = NULL; in qib_create_cq()
287 if (cq->ip) { in qib_create_cq()
289 list_add(&cq->ip->pending_mmaps, &dev->pending_mmaps); in qib_create_cq()
298 cq->dd = dd_from_dev(dev); in qib_create_cq()
299 cq->ibcq.cqe = entries; in qib_create_cq()
300 cq->notify = IB_CQ_NONE; in qib_create_cq()
301 cq->triggered = 0; in qib_create_cq()
302 spin_lock_init(&cq->lock); in qib_create_cq()
303 init_kthread_work(&cq->comptask, send_complete); in qib_create_cq()
306 cq->queue = wc; in qib_create_cq()
308 ret = &cq->ibcq; in qib_create_cq()
313 kfree(cq->ip); in qib_create_cq()
317 kfree(cq); in qib_create_cq()
333 struct qib_cq *cq = to_icq(ibcq); in qib_destroy_cq() local
335 flush_kthread_work(&cq->comptask); in qib_destroy_cq()
339 if (cq->ip) in qib_destroy_cq()
340 kref_put(&cq->ip->ref, qib_release_mmap_info); in qib_destroy_cq()
342 vfree(cq->queue); in qib_destroy_cq()
343 kfree(cq); in qib_destroy_cq()
360 struct qib_cq *cq = to_icq(ibcq); in qib_req_notify_cq() local
364 spin_lock_irqsave(&cq->lock, flags); in qib_req_notify_cq()
369 if (cq->notify != IB_CQ_NEXT_COMP) in qib_req_notify_cq()
370 cq->notify = notify_flags & IB_CQ_SOLICITED_MASK; in qib_req_notify_cq()
373 cq->queue->head != cq->queue->tail) in qib_req_notify_cq()
376 spin_unlock_irqrestore(&cq->lock, flags); in qib_req_notify_cq()
389 struct qib_cq *cq = to_icq(ibcq); in qib_resize_cq() local
424 spin_lock_irq(&cq->lock); in qib_resize_cq()
429 old_wc = cq->queue; in qib_resize_cq()
431 if (head > (u32) cq->ibcq.cqe) in qib_resize_cq()
432 head = (u32) cq->ibcq.cqe; in qib_resize_cq()
434 if (tail > (u32) cq->ibcq.cqe) in qib_resize_cq()
435 tail = (u32) cq->ibcq.cqe; in qib_resize_cq()
437 n = cq->ibcq.cqe + 1 + head - tail; in qib_resize_cq()
445 if (cq->ip) in qib_resize_cq()
449 if (tail == (u32) cq->ibcq.cqe) in qib_resize_cq()
454 cq->ibcq.cqe = cqe; in qib_resize_cq()
457 cq->queue = wc; in qib_resize_cq()
458 spin_unlock_irq(&cq->lock); in qib_resize_cq()
462 if (cq->ip) { in qib_resize_cq()
464 struct qib_mmap_info *ip = cq->ip; in qib_resize_cq()
489 spin_unlock_irq(&cq->lock); in qib_resize_cq()