thunderbolt: Add support for end-to-end flow control
authorMika Westerberg <mika.westerberg@linux.intel.com>
Mon, 19 Oct 2020 16:15:20 +0000 (19:15 +0300)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Wed, 11 Nov 2020 07:20:16 +0000 (10:20 +0300)
commitafe704a2d0618ebdb559b5ddb059f6cdbfc78783
tree886cdf8b13452596fbb6b900071652a95f517ed2
parent5bf722df5d37e82fd252b1d3e37cde4eab355c1c
thunderbolt: Add support for end-to-end flow control

USB4 spec defines end-to-end (E2E) flow control that can be used between
hosts to prevent overflow of a RX ring. We previously had this partially
implemented but that code was removed with commit 53f13319d131
("thunderbolt: Get rid of E2E workaround") with the idea that we add it
back properly if there ever is need. Now that we are going to add DMA
traffic test driver (in subsequent patches) this can be useful.

For this reason we modify tb_ring_alloc_rx/tx() so that they accept
RING_FLAG_E2E and configure the hardware ring accordingly. The RX side
also requires passing TX HopID (e2e_tx_hop) used in the credit grant
packets.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Yehezkel Bernat <YehezkelShB@gmail.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/thunderbolt.c
drivers/thunderbolt/ctl.c
drivers/thunderbolt/nhi.c
include/linux/thunderbolt.h