/* This may be called from interrupt context. Also called by ib_req_notify_cq() in the generic verbs code.  */
int ipath_req_notify_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags notify_flags)
/* This may be called from interrupt context. Also called by ib_req_notify_cq() in the generic verbs code.  */
int ipath_req_notify_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags notify_flags)
{
	struct ipath_cq *cq = to_icq(ibcq);
	unsigned long flags;
	int ret = 0;
	spin_lock_irqsave(&cq->lock, flags);
	if (cq->notify != IB_CQ_NEXT_COMP)
		cq->notify = notify_flags & IB_CQ_SOLICITED_MASK;
	if ((notify_flags & IB_CQ_REPORT_MISSED_EVENTS) &&
	    cq->queue->head != cq->queue->tail)
		ret = 1;
	spin_unlock_irqrestore(&cq->lock, flags);
	return ret;
}