Lines Matching refs:cq
47 void ipath_cq_enter(struct ipath_cq *cq, struct ib_wc *entry, int solicited) in ipath_cq_enter() argument
54 spin_lock_irqsave(&cq->lock, flags); in ipath_cq_enter()
60 wc = cq->queue; in ipath_cq_enter()
62 if (head >= (unsigned) cq->ibcq.cqe) { in ipath_cq_enter()
63 head = cq->ibcq.cqe; in ipath_cq_enter()
68 spin_unlock_irqrestore(&cq->lock, flags); in ipath_cq_enter()
69 if (cq->ibcq.event_handler) { in ipath_cq_enter()
72 ev.device = cq->ibcq.device; in ipath_cq_enter()
73 ev.element.cq = &cq->ibcq; in ipath_cq_enter()
75 cq->ibcq.event_handler(&ev, cq->ibcq.cq_context); in ipath_cq_enter()
79 if (cq->ip) { in ipath_cq_enter()
100 if (cq->notify == IB_CQ_NEXT_COMP || in ipath_cq_enter()
101 (cq->notify == IB_CQ_SOLICITED && solicited)) { in ipath_cq_enter()
102 cq->notify = IB_CQ_NONE; in ipath_cq_enter()
103 cq->triggered++; in ipath_cq_enter()
108 tasklet_hi_schedule(&cq->comptask); in ipath_cq_enter()
111 spin_unlock_irqrestore(&cq->lock, flags); in ipath_cq_enter()
114 to_idev(cq->ibcq.device)->n_wqe_errs++; in ipath_cq_enter()
130 struct ipath_cq *cq = to_icq(ibcq); in ipath_poll_cq() local
137 if (cq->ip) { in ipath_poll_cq()
142 spin_lock_irqsave(&cq->lock, flags); in ipath_poll_cq()
144 wc = cq->queue; in ipath_poll_cq()
146 if (tail > (u32) cq->ibcq.cqe) in ipath_poll_cq()
147 tail = (u32) cq->ibcq.cqe; in ipath_poll_cq()
153 if (tail >= cq->ibcq.cqe) in ipath_poll_cq()
160 spin_unlock_irqrestore(&cq->lock, flags); in ipath_poll_cq()
168 struct ipath_cq *cq = (struct ipath_cq *)data; in send_complete() local
178 u8 triggered = cq->triggered; in send_complete()
180 cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context); in send_complete()
182 if (cq->triggered == triggered) in send_complete()
204 struct ipath_cq *cq; in ipath_create_cq() local
215 cq = kmalloc(sizeof(*cq), GFP_KERNEL); in ipath_create_cq()
216 if (!cq) { in ipath_create_cq()
246 cq->ip = ipath_create_mmap_info(dev, sz, context, wc); in ipath_create_cq()
247 if (!cq->ip) { in ipath_create_cq()
252 err = ib_copy_to_udata(udata, &cq->ip->offset, in ipath_create_cq()
253 sizeof(cq->ip->offset)); in ipath_create_cq()
259 cq->ip = NULL; in ipath_create_cq()
271 if (cq->ip) { in ipath_create_cq()
273 list_add(&cq->ip->pending_mmaps, &dev->pending_mmaps); in ipath_create_cq()
282 cq->ibcq.cqe = entries; in ipath_create_cq()
283 cq->notify = IB_CQ_NONE; in ipath_create_cq()
284 cq->triggered = 0; in ipath_create_cq()
285 spin_lock_init(&cq->lock); in ipath_create_cq()
286 tasklet_init(&cq->comptask, send_complete, (unsigned long)cq); in ipath_create_cq()
289 cq->queue = wc; in ipath_create_cq()
291 ret = &cq->ibcq; in ipath_create_cq()
296 kfree(cq->ip); in ipath_create_cq()
300 kfree(cq); in ipath_create_cq()
316 struct ipath_cq *cq = to_icq(ibcq); in ipath_destroy_cq() local
318 tasklet_kill(&cq->comptask); in ipath_destroy_cq()
322 if (cq->ip) in ipath_destroy_cq()
323 kref_put(&cq->ip->ref, ipath_release_mmap_info); in ipath_destroy_cq()
325 vfree(cq->queue); in ipath_destroy_cq()
326 kfree(cq); in ipath_destroy_cq()
343 struct ipath_cq *cq = to_icq(ibcq); in ipath_req_notify_cq() local
347 spin_lock_irqsave(&cq->lock, flags); in ipath_req_notify_cq()
352 if (cq->notify != IB_CQ_NEXT_COMP) in ipath_req_notify_cq()
353 cq->notify = notify_flags & IB_CQ_SOLICITED_MASK; in ipath_req_notify_cq()
356 cq->queue->head != cq->queue->tail) in ipath_req_notify_cq()
359 spin_unlock_irqrestore(&cq->lock, flags); in ipath_req_notify_cq()
372 struct ipath_cq *cq = to_icq(ibcq); in ipath_resize_cq() local
407 spin_lock_irq(&cq->lock); in ipath_resize_cq()
412 old_wc = cq->queue; in ipath_resize_cq()
414 if (head > (u32) cq->ibcq.cqe) in ipath_resize_cq()
415 head = (u32) cq->ibcq.cqe; in ipath_resize_cq()
417 if (tail > (u32) cq->ibcq.cqe) in ipath_resize_cq()
418 tail = (u32) cq->ibcq.cqe; in ipath_resize_cq()
420 n = cq->ibcq.cqe + 1 + head - tail; in ipath_resize_cq()
428 if (cq->ip) in ipath_resize_cq()
432 if (tail == (u32) cq->ibcq.cqe) in ipath_resize_cq()
437 cq->ibcq.cqe = cqe; in ipath_resize_cq()
440 cq->queue = wc; in ipath_resize_cq()
441 spin_unlock_irq(&cq->lock); in ipath_resize_cq()
445 if (cq->ip) { in ipath_resize_cq()
447 struct ipath_mmap_info *ip = cq->ip; in ipath_resize_cq()
472 spin_unlock_irq(&cq->lock); in ipath_resize_cq()