[openib-general] [PATCH] (repost) no qp lock on poll, separate sq/rq locks

Roland Dreier roland at topspin.com
Fri Feb 25 07:13:55 PST 2005


+	cur = wq->next > wq->last_comp ? wq->next - wq->last_comp - 1 :
+		wq->next + wq->max - wq->last_comp - 1;

The problem is that there are only wq->max possible values of wq->next
and wq->last_comp (0 ... wq->max-1), but there are wq->max+1 possible
values of cur (from 0 posted up to wq->max posted).  So it's not
possible to distinguish between a full WQ and an empty one.

For example, wq->next is initialized to 0 and wq->last_comp is
initialized to wq->max - 1 and the WQ is empty.  But after posting
wq->max WQEs with no completions, wq->next will be back to 0 and
wq->last_comp will still be wq->max - 1.  So we can't tell if the WQ
is full or empty.

I think the solution is to keep track of the last completed index too,
and then we can figure out how many WQEs a completion is for.

 - R.



More information about the general mailing list