]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/infiniband/hw/amso1100/c2_cq.c
Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-omap-h63xx.git] / drivers / infiniband / hw / amso1100 / c2_cq.c
index 5175c99ee586cc34000450cc68d1a56b0fe1773c..bb17cce3cb592dfb079cec561b11d1aa58b33221 100644 (file)
@@ -217,17 +217,19 @@ int c2_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry)
        return npolled;
 }
 
-int c2_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify)
+int c2_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags notify_flags)
 {
        struct c2_mq_shared __iomem *shared;
        struct c2_cq *cq;
+       unsigned long flags;
+       int ret = 0;
 
        cq = to_c2cq(ibcq);
        shared = cq->mq.peer;
 
-       if (notify == IB_CQ_NEXT_COMP)
+       if ((notify_flags & IB_CQ_SOLICITED_MASK) == IB_CQ_NEXT_COMP)
                writeb(C2_CQ_NOTIFICATION_TYPE_NEXT, &shared->notification_type);
-       else if (notify == IB_CQ_SOLICITED)
+       else if ((notify_flags & IB_CQ_SOLICITED_MASK) == IB_CQ_SOLICITED)
                writeb(C2_CQ_NOTIFICATION_TYPE_NEXT_SE, &shared->notification_type);
        else
                return -EINVAL;
@@ -241,7 +243,13 @@ int c2_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify)
         */
        readb(&shared->armed);
 
-       return 0;
+       if (notify_flags & IB_CQ_REPORT_MISSED_EVENTS) {
+               spin_lock_irqsave(&cq->lock, flags);
+               ret = !c2_mq_empty(&cq->mq);
+               spin_unlock_irqrestore(&cq->lock, flags);
+       }
+
+       return ret;
 }
 
 static void c2_free_cq_buf(struct c2_dev *c2dev, struct c2_mq *mq)
@@ -414,8 +422,8 @@ void c2_free_cq(struct c2_dev *c2dev, struct c2_cq *cq)
                goto bail1;
 
        reply = (struct c2wr_cq_destroy_rep *) (unsigned long) (vq_req->reply_msg);
-
-       vq_repbuf_free(c2dev, reply);
+       if (reply)
+               vq_repbuf_free(c2dev, reply);
       bail1:
        vq_req_free(c2dev, vq_req);
       bail0: