Re: [RFC] URBs and buffer management

Marcel Holtmann <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <1181047435.13429.106.camel@violet>
Hi Oliver,

> > > > an alternate way would be to extend the usb_kill_anchored_urbs() with
> > > > its own complete handler that gets called for every anchored URB. This
> > > > would make it possible to cleanup the allocated buffers. I attached a
> > > > patch for that, too.
> > > 
> > > No, that would mean an URB could have both its original and the additional
> > > handler or only the additional handler called. That's increasing complexity,
> > > not lowering it.
> > 
> > depends on how you use it. I would only use the original complete
> > handler to do the re-submission of the URB and the additional handler to
> > free the allocated buffers. For that use case it works perfectly fine.
> > 
> > To avoid confusion we could rename it to usb_release_t or something
> > similar.
> 
> One usage is a bit weak to add common code.

this is why I wanna have a general solution for one-shot buffers.

> > > It seems to me that freeing buffers in usbcore is the logical conclusion
> > > of the pattern used in usb-skeleton. It may be used to avoid calling a
> > > completion handler at all.
> > 
> > I agree that it is the cleanest to free the buffers when URB is no
> > longer in use. Normally that means that any allocated buffer for this
> > URB is also not needed anymore.
> > 
> > Actually I am happy with any solution that frees the driver from having
> > to track the buffers for incoming endpoints used by an URB.
> 
> I am fine with your original patch. Perhaps you should resend it.

Greg, did you see that patch? Do you have any comments on it? If the
solution is acceptable, I can complete the patch with the missing
helpers and "officially" submit it.

> > For outgoing URBs the current approach with a separate buffer makes
> > sense. This allows me to use an skb->data directly without copying the
> > data first. Works really nicely in the new driver.
> 
> Nice to hear.

The new USB anchors seem to work pretty fine. No crashes.

Regards

Marcel



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.