Skip to content

Commit

Permalink
IB/mlx4: Check if SRQ is full when posting receive
Browse files Browse the repository at this point in the history
Make mlx4_post_srq_recv() fail if the SRQ is full (head == tail).

Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Roland Dreier committed May 21, 2007
1 parent 2446304 commit 56a8c8b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/infiniband/hw/mlx4/srq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 56a8c8b

Please sign in to comment.