aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Cohen <eli@mellanox.co.il>2008-02-03 23:21:43 -0800
committerRoland Dreier <rolandd@cisco.com>2008-02-03 23:21:43 -0800
commit1ace3933cb9e53ac2a15bdf430b1006b15b1cf85 (patch)
treeac35b9bac8c0cdb5a01ac5a4ee013bf3e76e2a0c
parent063b9070bb4f9f0a9789f96dd4166eaae248bb25 (diff)
downloadlibmthca-1ace3933cb9e53ac2a15bdf430b1006b15b1cf85.tar.gz
Remove checks for srq->first_free < 0
The SRQ receive posting functions make sure that srq->first_free never becomes negative, so we can remove tests of whether it is negative. Signed-off-by: Eli Cohen <eli@mellanox.co.il> Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r--src/srq.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/src/srq.c b/src/srq.c
index f9fc006..40d1f59 100644
--- a/src/srq.c
+++ b/src/srq.c
@@ -66,11 +66,7 @@ void mthca_free_srq_wqe(struct mthca_srq *srq, int ind)
{
pthread_spin_lock(&srq->lock);
- if (srq->first_free >= 0)
- *wqe_to_link(get_wqe(srq, srq->last_free)) = ind;
- else
- srq->first_free = ind;
-
+ *wqe_to_link(get_wqe(srq, srq->last_free)) = ind;
*wqe_to_link(get_wqe(srq, ind)) = -1;
srq->last_free = ind;
@@ -97,14 +93,7 @@ int mthca_tavor_post_srq_recv(struct ibv_srq *ibsrq,
first_ind = srq->first_free;
for (nreq = 0; wr; wr = wr->next) {
- ind = srq->first_free;
-
- if (ind < 0) {
- err = -1;
- *bad_wr = wr;
- break;
- }
-
+ ind = srq->first_free;
wqe = get_wqe(srq, ind);
next_ind = *wqe_to_link(wqe);
@@ -205,14 +194,7 @@ int mthca_arbel_post_srq_recv(struct ibv_srq *ibsrq,
pthread_spin_lock(&srq->lock);
for (nreq = 0; wr; ++nreq, wr = wr->next) {
- ind = srq->first_free;
-
- if (ind < 0) {
- err = -1;
- *bad_wr = wr;
- break;
- }
-
+ ind = srq->first_free;
wqe = get_wqe(srq, ind);
next_ind = *wqe_to_link(wqe);