[openib-general] [PATCH][RFC] uverbs SRQ implementation

Fab Tillier ftillier at silverstorm.com
Wed Aug 3 11:12:39 PDT 2005


> From: Grant Grundler [mailto:iod00d at hp.com]
> Sent: Wednesday, August 03, 2005 10:56 AM
> 
> On Wed, Aug 03, 2005 at 09:28:04AM -0700, Roland Dreier wrote:
> > Feedback in the meantime appreciated, though...
> ...
> >  	if (!pd  || pd->uobject->context  != file->ucontext ||
> >  	    !scq || scq->uobject->context != file->ucontext ||
> > -	    !rcq || rcq->uobject->context != file->ucontext) {
> > +	    !rcq || rcq->uobject->context != file->ucontext ||
> > +	    (cmd.is_srq && (!srq || srq->uobject->context != file->ucontext))) {
> 
> I think it's redudant to test cmd.is_srq.
> srq is NULL if cmd.is_srq is not set.
> ie !srq should short circuit the rest of the test.
> 
> if idr_find() fails, I would expect it to return NULL.

If idr_find returns NULL when cmd.is_srq is non-zero, then the user passed an
invalid parameter.  Likewise, if the SRQ is not null, but its context doesn't
match, that's also an invalid parameter.

If cmd.is_srq is zero, then a NULL SRQ is perfectly fine, and there's no need to
fail the call.

That is, the check for (!srq || srq->uobject->context != file->ucontext) must
only be performed if cmd.is_srq is non-zero.

- Fab




More information about the general mailing list