]> git.openfabrics.org - ~shefty/libmlx4.git/commitdiff
Check if SRQ is full when posting receive
authorRoland Dreier <rolandd@cisco.com>
Mon, 21 May 2007 03:15:11 +0000 (20:15 -0700)
committerRoland Dreier <rolandd@cisco.com>
Mon, 21 May 2007 03:15:11 +0000 (20:15 -0700)
Make mlx4_post_srq_recv() fail if the SRQ is full (head == tail).

Signed-off-by: Roland Dreier <rolandd@cisco.com>
src/srq.c

index b6d7635d61bc7aa01d33ab64aed629cfb137f5c4..ba2ceb91b51c5fc27cea837c8a3a3ec5dd713620 100644 (file)
--- a/src/srq.c
+++ b/src/srq.c
@@ -81,6 +81,13 @@ int mlx4_post_srq_recv(struct ibv_srq *ibsrq,
                        break;
                }
 
+               if (srq->head == srq->tail) {
+                       /* SRQ is full*/
+                       err = -1;
+                       *bad_wr = wr;
+                       break;
+               }
+
                srq->wrid[srq->head] = wr->wr_id;
 
                next      = get_wqe(srq, srq->head);