Re: Overly conservative xHCI bandwidth estimation

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

 



On Wed, 23 Sep 2015, Steinar H. Gunderson wrote:

> Hi again,
> 
> I'm trying to figure out why my xHCI controller refuses me to run two very
> similar video cards at the same time. I'm not sure if this is a bug or if I'm
> just misunderstanding, so let me see if I understand this right:
> 
> The interface of each card has two relevant alternates, 2 and 4. Number 2 has 
> bInterval=1, bMaxBurst=11, Mult=2, which from what I can see should be
> 11*(2+1)*1024 byte / 125µs, or 2.16 Gbit/sec. Number 4 has bInterval=1,
> bMaxBurst=8, Mult=1, which should be 8*(1+1)*1024 byte / 125 µs, or 1.04 Gbit/sec.
> 
> I can run one card in alternates 2 or 4, no problem. But if I put another
> card in the other USB port (my Lenovo X240 has one on each side) and try to
> activate that too, I get
> 
>   [  287.919173] usb 2-2: Not enough bandwidth for altsetting 4
> 
> I've tried on another machine and it works fine there, so my code should,
> at least on the surface of it, be fine. I've verified that the error is
> COMP_BW_ERR (not COMP_2ND_BW_ERR).
> 
> My xHCI controller is 8086:9c31 (I believe this is Intel). lsusb -v with both
> devices plugged in is attached. I'm running 4.3-rc2. There are no external
> USB hubs in the mix.
> 
> So this is my question: Why can I run one card at 2.16 Gbit/sec but not two
> at 1.04 Gbit/sec each? (Shouldn't the USB3 bus be 5 Gbit/sec?) Is there any
> way to debug these issues, or is the controller just deciding and unwilling
> to give out any information? Is the information of the bandwidth domains/
> bus instances available anywhere? Am I misunderstanding something
> fundamentally?

Like Krzysztof said, it's more complicated than this.  No more than 80% 
of the total bus capacity can be allocated for periodic transfers.  In 
addition, USB-3.0 doesn't really handle 5 Gb/s.  That's the bit rate of 
the bus itself, but data on the bus gets encoded in way that requires 
10 bits of bus traffic for every 8 bits of data transferred.  Thus the 
available bandwidth is really 4 Gb/s -- and part of that is used up by 
overhead.

However, none of this answers the question of why you can use both
cards on a different machine but not on yours.  It comes down to the
implementations of the xHCI controller chips.  In USB-3, bandwidth
allocation is handled by firmware running on the controller, not by the
operating system's driver.  The driver presents a series of endpoints
with all their bandwidth requirements to the controller, and the
controller either accepts it or rejects it.  It doesn't give any
explanation for its decision, and as far as I know, it doesn't provide 
any information about the details of how it allocates the bandwidth.

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