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

Michael S. Tsirkin mst at mellanox.co.il
Fri Feb 25 07:26:29 PST 2005


Quoting r. Roland Dreier <roland at topspin.com>:
> Subject: Re: [PATCH] (repost) no qp lock on poll, separate sq/rq locks
> 
> +	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.
> 

Hmm. One option is to add 1 spare wqe to qp size and be done with it.

If you consider that hardware dictates this for cq, anyway
(cq is a power of 2 in size but can have 1 less cqe), maybe its
the right thing to do?

-- 
MST - Michael S. Tsirkin



More information about the general mailing list