On Thu, 11 Nov 2004, Xu Levis-Q16136 wrote:
> Dear all,
> I have written a simple bulkusb driver to test the usb transfer speed. Just
> transfer 256bytes*1000 between host and client. The test result is following:
> transfer data transfer speed
> host--->client 256bytes*1000 256K bytes/second
> client--->host 256bytes*1000 62K bytes/second
>
> I'm very confused of this transfer speed(client--->host) result. From the usb
> analyzer snap data, the time is almost spent on "Waitting for next IN Token".
> My bulkusb codes is the following:
> ...
> bulkusb_probe()
> {...
> /*Build a read urb and send a IN token first time*/
> FILL_BULK_URB(&bulkusb->readurb, usbdev, usb_rcvbulkpipe(usbdev,
> bulkusb->bulk_in_ep),
> bulkusb->ibuf, readsize, bulkusb_readback, bulkusb);
> bulkusb->readurb.transfer_flags |= USB_ASYNC_UNLINK;
>
> /*send a IN token first time*/
> bulkusb->readurb.dev = bulkusb->bulkusb_dev;
> if(usb_submit_urb(&bulkusb->readurb))
> {
> printk("bulkusb_probe: usb_submit_urb(read) failed!\n");
> }
> ...
> }
>
> bulkusb_readback(struct urb *urb)
> {...
> urb->actual_length = 0;
> urb->dev = bulkusb->bulkusb_dev;
> if (usb_submit_urb(urb))
> {
> printk("failed resubmitting read urb\n");
> }
> ...
> }
>
> Usb analyzer snap data:
> <<...OLE_Obj...>>
>
> Could anybodies help me analyze or give me some advice? Thanks a lot!
You didn't say what version of Linux you used or what type of host
controller. You didn't even say what speed, although it looks like full
speed from the numbers. And you didn't say what device you are using for
testing.
To get optimal performance you should queue more than one URB at a time so
that the bus is always kept busy. But don't queue more than about 50 ms
worth of data at once.
For the conditions you described, you could try keeping 3 URBs in the
queue, each of size 4096. If the throughput improves you can try
increasing either the number of URBs or their size.
Alan Stern
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel