Re: weird USB test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Please configure your email client to wrap lines after 70 characters or 
so.

On Tue, 14 Jul 2009, cihan öztürk wrote:

> Hi everyone,
> I am experiencing a weird situation in my USB based communication test platform.
> Test platform is composed of:
> - a user application statically linked to user level libraries that handle basic communication with an external USB device (running on a PC)
> - a custom USB device driver that interfaces the application to the external device (running on a PC)
> - a firmware that receives requests from PC, and sends responses back (running on a 8051 based Silabs F340 device)
> The communication is carried out by the CPU sending requests and receiving responses with a write system call, implemented by the driver, and then simply copying received responses from kernel to local application buffer with a read system call. So, only the write call communicates with the external USB device, which involves two urb submissions, one write and one read. Since the device supports Full speed mode, this communication is continuously initiated by the CPU every 2ms, which operates fine until the size of transfer within a frame is increased to 6*33=198 bytes(6 packets of 33 byte each). After that, the requests at the CPU application start accumulating and memory leak is observed at the CPU in a linear fashion, which is I guess something expected since the bandwidth reserved for the device is limited. (This test achieves about 1.72Mbps communication when two way communication is considered, where 6 "write to device" and 6 "read from device"
>  requests are initiated within frame, "write to device" occuring in first frame, and "read from device" occuring in the next frame)
> 
> The weird situation is observed when more than one USB device is used for communication at the same time. We tried connecting up to 5 devices and a single device achieved up to 15*33=495 bytes of transfer without any leak, where 15 is the maximum amount of packets allowed in our own protocol within a frame (That makes about 4.3Mbps per device). So 5 devices add up to more than 20Mbps.
> 
> 1) Isn't it strange that accumulation of requests occur when one device is used for communication, whereas no accumulation is observed with so many devices at the same time, consuming so much bandwidth?
> 
> 2) How is it possible to add the total bandwidth in multi device test to 20Mpbs? Doesn't USB controller assign 12Mpbs of bandwidth at Full Speed? Is it possible that USB HC assigns 12Mpbs per each single device connected?
> 
> Just one more detail, the PC has two internal hubs, which allow up to 4 devices to be connected at the same time. For the 5 device case, an external hub is used. But all tests, whether external hub is used or not, give the same result that, HC looks to behave differently in scenarios where a single device communication is involved, and a multi device communication is involved.

Your description leaves out a lot of important information:

	What type are your transfers (bulk, interrupt, control)?
	If they are interrupt, what is the period?

	What are the maxpacket values?  What are the actual packet
	sizes (you said some of them are 33 bytes)?

	How many packets do you send in each frame?  How many packets
	do you receive in each frame?

	Is your external hub full speed (USB 1.1) or high speed (USB
	2.0)?

	Why don't you fix your kernel driver so that it doesn't leak 
	memory?

You should try looking at a usbmon trace to see what's really
happening.

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

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux