]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/infiniband/hw/ehca/ehca_cq.c
IB/ehca: Support more than 4k QPs for userspace and kernelspace
[linux-2.6-omap-h63xx.git] / drivers / infiniband / hw / ehca / ehca_cq.c
index 81aff36101ba5944fab04c22030f7b35a1a61f07..a6f17e488c77f536790ce69c3e3b4f988aa490e3 100644 (file)
@@ -166,7 +166,6 @@ struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, int comp_vector,
                write_lock_irqsave(&ehca_cq_idr_lock, flags);
                ret = idr_get_new(&ehca_cq_idr, my_cq, &my_cq->token);
                write_unlock_irqrestore(&ehca_cq_idr_lock, flags);
-
        } while (ret == -EAGAIN);
 
        if (ret) {
@@ -176,6 +175,12 @@ struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, int comp_vector,
                goto create_cq_exit1;
        }
 
+       if (my_cq->token > 0x1FFFFFF) {
+               cq = ERR_PTR(-ENOMEM);
+               ehca_err(device, "Invalid number of cq. device=%p", device);
+               goto create_cq_exit2;
+       }
+
        /*
         * CQs maximum depth is 4GB-64, but we need additional 20 as buffer
         * for receiving errors CQEs.