summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/mlx4/srq.c
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2007-05-21 07:19:24 +0400
committerRoland Dreier <rolandd@cisco.com>2007-05-21 07:19:24 +0400
commit56a8c8b6ac4d6edba5153d17730aaf96ba8f1f8c (patch)
treefc28e73631879993d822f4623633caed0e1daa58 /drivers/infiniband/hw/mlx4/srq.c
parent2446304dd687488c054d0437f2aeef1ef2bfbd02 (diff)
downloadlinux-56a8c8b6ac4d6edba5153d17730aaf96ba8f1f8c.tar.xz
IB/mlx4: Check if SRQ is full when posting receive
Make mlx4_post_srq_recv() fail if the SRQ is full (head == tail). Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/mlx4/srq.c')
-rw-r--r--drivers/infiniband/hw/mlx4/srq.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mlx4/srq.c b/drivers/infiniband/hw/mlx4/srq.c
index 42ab4a801d6a..12fac1c8989d 100644
--- a/drivers/infiniband/hw/mlx4/srq.c
+++ b/drivers/infiniband/hw/mlx4/srq.c
@@ -297,6 +297,12 @@ int mlx4_ib_post_srq_recv(struct ib_srq *ibsrq, struct ib_recv_wr *wr,
break;
}
+ if (unlikely(srq->head == srq->tail)) {
+ err = -ENOMEM;
+ *bad_wr = wr;
+ break;
+ }
+
srq->wrid[srq->head] = wr->wr_id;
next = get_wqe(srq, srq->head);