Re: Limit on Maximum Asynchronous URBs
Stephan Meyer <ste_meyer <at> web.de>
2006-06-13 17:18:31 GMT
Libusb's kernel driver doesn't have any built-in limitations because
it doesn't internally queue any data. It just allocates an URB for each
userspace request and passes that URB down the stack.
But it should be obvious that the host controller driver has to queue
these request and that the size of this queue is limited since kernel
memory is a limited resource.
I wrote a small test program (see attachment) to see how many requests
Windows' USB stack can handle at once. And the limit on WinXP-SP2
(with 1GB of RAM) seems to be exactly 2500 URBs regardless of the URB's
data size.
The maximum amount of data I was able to request at once with the test
program was 2500 URB each with 64kB of data. That's more than 150MB!
This limit may depend on the host controller driver and the Windows version.
Stephan
> Hi all,
>
> I did some poking around on the web but have had a hard time finding an answer
> to this question. Maybe someone here knows.
>
> Is there a maximum number of URBs that can be submitted to an endpoint /
> interface / device at any given time? For example, can I submit 1024 URBs
> each with 16 KB data to a read endpoint or will I be restricted by the driver
> stack, host controller, or something else? If there is such a restriction,
> does it apply to the device as a whole, just the interface, or just the
> endpoint?
>
> Any insights would be much appreciated.
>
> Best regards,
> Gopal
>
>
> _______________________________________________
> Libusb-win32-devel mailing list
> Libusb-win32-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
__________________________________________________________________________
Erweitern Sie FreeMail zu einem noch leistungsstärkeren E-Mail-Postfach!
Mehr Infos unter http://freemail.web.de/home/landingpad/?mc=021131
#include <stdio.h>
#include "main.h"
#define NUM_PACKETS 1024
#define PACKET_SIZE (16 * 1024)
int main(int argc, char **argv)
{
usb_dev_handle *dev;
int i;
char tmp[PACKET_SIZE];
void *packets[NUM_PACKETS];
usb_init();
usb_set_debug(4);
usb_find_busses();
usb_find_devices();
dev = usb_open_test_device(0);
usb_set_configuration(dev, 1);
usb_claim_interface(dev, 0);
usb_set_altinterface(dev, 2);
for(i = 0; i < NUM_PACKETS; i++)
{
if(usb_bulk_setup_async(dev, &packets[i], 0x82) < 0)
{
printf("allocating packet %d failed\n", i);
return 0;
}
}
for(i = 0; i < NUM_PACKETS; i++)
{
if(usb_submit_async(packets[i], tmp, sizeof(tmp)) < 0)
{
printf("submitting packet %d failed\n", i);
return 0;
}
}
for(i = 0; i < NUM_PACKETS; i++)
{
if(usb_reap_async(packets[i], 5000) != sizeof(tmp))
{
printf("reaping packet %d failed\n", i);
return 0;
}
}
for(i = 0; i < NUM_PACKETS; i++)
{
usb_free_async(&packets[i]);
}
usb_release_interface(dev, 0);
usb_close(dev);
return 0;
}
#include <stdio.h>
#include "main.h"
#define NUM_PACKETS 1024
#define PACKET_SIZE (16 * 1024)
int main(int argc, char **argv)
{
usb_dev_handle *dev;
int i;
char tmp[PACKET_SIZE];
void *packets[NUM_PACKETS];
usb_init();
usb_set_debug(4);
usb_find_busses();
usb_find_devices();
dev = usb_open_test_device(0);
usb_set_configuration(dev, 1);
usb_claim_interface(dev, 0);
usb_set_altinterface(dev, 2);
for(i = 0; i < NUM_PACKETS; i++)
{
if(usb_bulk_setup_async(dev, &packets[i], 0x82) < 0)
{
printf("allocating packet %d failed\n", i);
return 0;
}
}
for(i = 0; i < NUM_PACKETS; i++)
{
if(usb_submit_async(packets[i], tmp, sizeof(tmp)) < 0)
{
printf("submitting packet %d failed\n", i);
return 0;
}
}
for(i = 0; i < NUM_PACKETS; i++)
{
if(usb_reap_async(packets[i], 5000) != sizeof(tmp))
{
printf("reaping packet %d failed\n", i);
return 0;
}
}
for(i = 0; i < NUM_PACKETS; i++)
{
usb_free_async(&packets[i]);
}
usb_release_interface(dev, 0);
usb_close(dev);
return 0;
}
_______________________________________________
Libusb-win32-devel mailing list
Libusb-win32-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel