Re: gadget file storage with variable maxpacket

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Wed, 14 Nov 2007, ilya wrote:

> wireless usb will be introducing a lot of new control requests, flow
> control [ie: stalling endpoints should be the last resort because in wusb
> you can NAK and the host will wait for a special device notification to send
> a transfer token instead of constantly polling as in wired usb], association,
> etc. i think a lot of these things could be handled by the controller driver,
> but there are a lot of other stuff that could be standardized and handled
> by the "gadget" client side.

Do any of these things affect wired USB?

> i figured out how to change the maxpacket in the descriptors, what
> i am having problem with is queuing-in of the requests and
> writing to disk. the fs gadget tends to queue in requests of size 512
> during writes/reads of, for example 64k, to either stay in the page
> boundaries or because it rounded down to stay in the block boundaries.

What do you mean?  Are you talking about request lengths for USB 
transfers?  For disk reads (IN to the host), the request length is the 
same as the amount read from the disk, which is limited only by the 
buffer size (the default is 16 KB).  For disk writes the situation is 
similar.

Yes, some requests are smaller in order to align with page boundaries.  
But once the alignment has occurred, the following requests should all
be as large as possible.

> i, on the other hand, will be doing transfers of maxpacket 2048 so
> now i either have to concatenate transfers in my code, or tweak fs gadget
> to queue in requests with sizes of maxpacket multiples. i had
> success doing this for reads but not so much for writes.

You don't have to tweak anything.  Just because maxpacket is 2048, that
doesn't mean all your transfers have to be 2048 bytes long.  There's
nothing wrong with short packets or with transfers that extend across 
multiple packets.

(At least, that's true for wired USB.  I don't know much about wireless 
USB; perhaps it's different.)

> i think it would be nicer if fs gadget queued in requests based on
> the maxpacket specified for each endpoint by the controller driver
> and took care of all the page/block boundaries business during the
> actual reading/writing to disk.

In the end it wouldn't make much difference.  Can you provide any 
examples showing how it would help more than a little bit?

Alan Stern


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
[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.