On Tue, 11 May 2010, Felipe Balbi wrote: > Hi all, > > I'm trying to optimize the MUSB driver as much as I can and I believe I > got to its limit. Currently I'm getting: > > with my test application which simply bounces 1GB of data to device. I > have no NAKs, no PINGs and no NYETs but each bulk out transaction is > taking 15us which allows me to squeeze only 8 transactions per-uframe. > Ideally I would be able to have a bulk out transaction on every 10us > which would allow to squeeze up to 11 ~ 12 transactions per-uframe > allowing me to get 44 ~ 60 MB/sec. According to the USB-2.0 spec (table 5-10), the best possible speed for a full-size bulk transaction would be: OUT packet: 4 SYNC bytes, 1 PID byte, 2 EP/ADDR+CRC bytes, 12-byte interpacket delay -> 19 bytes = 316.7 ns DATA packet: 4 SYNC bytes, 1 PID byte, 512 data bytes, 2 CRC bytes, 12-byte interpacket delay -> 531 bytes = 8850 ns ACK packet: 4 SYNC bytes, 1 PID byte, 12-byte interpacket delay -> 17 bytes = 283.3 ns The total comes to 9450 ns, just under 10 us. In theory it's possible to get as many as 13 of these per uframe. Of course, this doesn't allow for bit-stuffing or other delays. Still, if you compare your measured values to these, you'll see where the extra delays are. > I know 60MB/sec is basically impossible due to HW limitations but > 44MB/sec (with 11 transactions per-uframe) is pretty much doable. Where > should I look into the USB subsystem to try to optimize that ? The host controller driver and hardware. > BTW, my application uses async API of libusb and queues 4 1MB bulk > out transfers before starting to send data, then it keeps on re-queueing > those URBs until I have reached 1GB of transferred data. Sniffer tells > me how many transactions I put on a uframe. That should allow you to achieve the maximum possible speed of the driver and hardware. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html