Merge branch 'drm-intel-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/keith...
[pandora-kernel.git] / drivers / infiniband / hw / cxgb4 / cq.c
index 8d8f8ad..1720dc7 100644 (file)
@@ -801,6 +801,10 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
        if (ucontext) {
                memsize = roundup(memsize, PAGE_SIZE);
                hwentries = memsize / sizeof *chp->cq.queue;
+               while (hwentries > T4_MAX_IQ_SIZE) {
+                       memsize -= PAGE_SIZE;
+                       hwentries = memsize / sizeof *chp->cq.queue;
+               }
        }
        chp->cq.size = hwentries;
        chp->cq.memsize = memsize;