[ofa-general] Re: [PATCH] ib/limthca: Remove an always true condition

Eli Cohen eli at dev.mellanox.co.il
Sat Jan 26 12:52:55 PST 2008


On Fri, Jan 25, 2008 at 09:13:07AM -0800, Roland Dreier wrote:
>  > > why is first_free always >= 0?  I don't see anything that guarantees
>  > > that,
>  > 
>  > The following two subsequent ifs gurantees that.
>  > 
>  >                if (ind < 0) {
>  >                         err = -1;
>  >                         *bad_wr = wr;
>  >                         break;
>  >                 }
>  > 
>  >                 wqe       = get_wqe(srq, ind);
>  >                 next_ind  = *wqe_to_link(wqe);
>  > 
>  >                 if (next_ind < 0) {
>  >                         err = -1;
>  >                         *bad_wr = wr;
>  >                         break;
>  >                 }
> 
> Duh... I missed that.  Thanks for the clue.
> 
> but now am I wrong to think that we could remove the first test of ind
> (not next_ind) in the fast path?  the second test guarantees that ind
> never becomes negative, as you pointed out.
> 
I think you're right. The first "if" can go away.



More information about the general mailing list