thunderbolt: Allocate credits according to router preferences
authorMika Westerberg <mika.westerberg@linux.intel.com>
Mon, 22 Mar 2021 16:09:35 +0000 (18:09 +0200)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Tue, 1 Jun 2021 07:48:59 +0000 (10:48 +0300)
commit6ed541c53edcd5bf3cbd9fd600fd593e95ec79fb
tree661f0178ab6fe3cacff2228aa4f9e8741417edfe
parent69fea377e660dcd2f5ab3097b9bd5ed29cfac1fa
thunderbolt: Allocate credits according to router preferences

The USB4 Connection Manager guide provides detailed information how the
USB4 router buffer (credit) allocation information should be used by the
connection manager when it allocates buffers for different paths. This
patch implements it for Linux. For USB 3.x and DisplayPort we use
directly the router preferences. The rest of the buffer space is then
used for PCIe and DMA (peer-to-peer, XDomain) traffic. DMA tunnels
require at least one buffer and PCIe six, so if there is not enough
buffers we fail the tunnel creation.

For the legacy Thunderbolt 1-3 devices we use the existing hard-coded
scheme except for DMA where we use the values suggested by the USB4 spec
chapter 13.

Co-developed-by: Gil Fine <gil.fine@intel.com>
Signed-off-by: Gil Fine <gil.fine@intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/thunderbolt/tb.h
drivers/thunderbolt/tunnel.c
drivers/thunderbolt/tunnel.h