USB Controller Resources Exceeded

I have a test system I’m working on that has about 3 dozen USB devices
plugged in, in a tree of hubs, to an XHCI controller. I now have to
plug in 10 identical USB thumb drives. The 10th drive fails with a
dialog saying “USB Controller Resources Exceeded”. These are all
plugged in to powered hubs (actually, two levels of powered hubs), so
power is not the issue. To get certified, a host controller has to be
able to handle 127 devices, so it shouldn’t be a “raw device count”
issue. It is an Intel XHCI controller, but these are all USB 2.0 devices.

I grabbed an ETW trace, and looks like the failure happens in response
to the CONFIGURE_ENDPOINT_COMMAND for the second bulk endpoint on the
device. I see:

UsbXhci:USBHCXI Endpoint Create
UsbUcx:UCX Endpoint Create
UsbXhci:USBXHCI Endpoint Create
UsbUcx:UCX Endpoint Create
UsbXhci:xHCI Command sent to Controller: CONFIGURE_ENDPOINT_COMMAND
UsbXhci:xHCI Command Complete with Error: Resource Error,
CONFIGURE_ENDPOINT_COMMAND
UsbHub3:UCX IOCTL Failed

The implication here is that the controller hardware itself rejected the
request, which seems odd to me. I don’t understand why the controller
would be involved at this point. It doesn’t need to know about any
endpoints until we start using the endpoints. Are there now resources
allocated in the controller hardware for USB endpoints?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

>Are there now resources allocated in the controller hardware for USB endpoints?

According to the eXtensible Host Controller Interface for Universal Serial Bus (xHCI) Revision 1.1 specification there can be host controller hardware implementation specific resources allocated per endpoint when an endpoint is configured.

It’s been over 2 years since I’ve looked at any of this and I don’t remember any details beyond what is in the specification:

http://www.intel.com/content/dam/www/public/us/en/documents/technical-specifications/extensible-host-controler-interface-usb-xhci.pdf

4.6.6 Configure Endpoint

The following rules apply to processing a Configure Endpoint Command:

The xHC maintains a global Resources Available variable, which is initialized to indicate all xHC resources are available. A Resource is an xHC implementation defined metric, which refers to the internal xHC data structures, buffer space, or other implementation specific resources required to support an endpoint type.

Two temporary variables are maintained by the xHC when evaluating the Configure Endpoint Command: Resource Required and Bandwidth Required. Both variables are initialized to ?0?.
The Resource Required variable identifies the ?sum? of xHC resources required to support all endpoints affected by a Configure Endpoint Command. Note that the ?units? of xHC resource measurement is an implementation specific value.

For each endpoint indicated by a Drop Context flag = ?1?:
If the Output Endpoint Context is not in the Disabled state:
The endpoint related resources are subtracted from the Resource Required variable.

For each Input Endpoint Context indicated by an Add Context flag = ?1?:
The resources required to support the endpoint described by the Input Endpoint Context shall be added to the Resource Required variable.

After all Drop Context and Add Context flags are evaluated the xHC determines whether the command was successful:
The Resources Required variable is compared to the Resources Available variable, if the result indicates an oversubscription of resources by the command (i.e. Resources Available - Resources Required is less than 0), then the command shall be unsuccessful and a Resource Error Completion Code shall be returned in the Command Completion Event.