Skip to content

Commit 2ff7d09

Browse files
Steve Wiserolandd
authored andcommitted
RDMA/cxgb4: Don't exceed hw IQ depth limit for user CQs
Memory allocated for user CQs gets rounded up to the next page boundary. And after rounding, we recalculate the resulting IQ depth and we need to make sure we don't exceed the HW limits. This bug can result a much smaller CQ allocated than was expected if the HW size field is exceeded, resulting in CQ overflow failures. Signed-off-by: Steve Wise <[email protected]> Signed-off-by: Roland Dreier <[email protected]>
1 parent 2c53b43 commit 2ff7d09

File tree

1 file changed

+4
-0
lines changed
  • drivers/infiniband/hw/cxgb4

1 file changed

+4
-0
lines changed

drivers/infiniband/hw/cxgb4/cq.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,10 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
801801
if (ucontext) {
802802
memsize = roundup(memsize, PAGE_SIZE);
803803
hwentries = memsize / sizeof *chp->cq.queue;
804+
while (hwentries > T4_MAX_IQ_SIZE) {
805+
memsize -= PAGE_SIZE;
806+
hwentries = memsize / sizeof *chp->cq.queue;
807+
}
804808
}
805809
chp->cq.size = hwentries;
806810
chp->cq.memsize = memsize;

0 commit comments

Comments
 (0)