Linux – How does the Linux kernel decide how much bandwidth to allocate to Isochronous USB endpoints

kernellinuxusb

As far as I'm aware, USB endpoints that use isochronous transfers have a 'wMaxPacketSize' parameter associated with them that is used by the kernel to guarantee a certain amount of bandwidth for the endpoint.

If I'm not mistaken, this maximum packet size can range anywhere between 0 to 1024 bytes (for high speed transfers). How does this parameter translate into bandwidth allocation in terms of Mbps of a high speed (EHCI) controller in a Linux system?

What other factors, if any, does USB bandwidth allocation depend on?

Thanks!

Best Answer

After some research, I can now answer my own question. The maximum isochronous packet size for high speed devices is 1024 bytes. There can be up to three packets per microframe, and a microframe is 125 microseconds wide, meaning that there can be 8 microframes transferred per millisecond.

This gives us a maximum bandwidth allocation of 3*1024*8*1000 = 23.438 MB/s (edit: used to say mbps)

The wMaxPacketSize parameter is a two byte value which contains a bit mapping of both the maximum size per packet and number of packets per microframe is stored.

Thus the bandwidth allocation is as follows:

(packets/microframe) * (max_packet_size) * (8 microframes/millisecond) * (1000ms/s)

It's also important to note that per USB 2.0 spec, only 80% of the total amount of bandwidth can be allocated to periodic transfers such as isochronous and interrupt transfers.

Related Question