Skip to content

thunderbolt: Add support for shared buffering

Mika Westerberg linux-usb sashiko-reviews 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest18 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/18thunderbolt: Avoid leaking of DMA tunnel after XDomain removaldrivers/thunderbolt/tb.c+12 -60 replies
2/18thunderbolt: Tear down DMA tunnels on every XDomain removaldrivers/thunderbolt/tb.c+24 -230 replies
3/18thunderbolt: Delay re-pairing DP IN/OUT if DPRX negotiation failsdrivers/thunderbolt/tb.c+23 -10 replies
4/18thunderbolt: Call DP tunnel activation callback with tb->lock helddrivers/thunderbolt/tb.c drivers/thunderbolt/tunnel.c+2 -60 replies
5/18thunderbolt: Re-apply Alpine/Titan Ridge flow on resumedrivers/thunderbolt/tb.c+18 -91 reply
6/18thunderbolt: Return -ESHUTDOWN when control channel is not runningdrivers/thunderbolt/ctl.c+1 -30 replies
7/18thunderbolt: Add usb4_port_hotplug_disable()drivers/thunderbolt/tb.h drivers/thunderbolt/usb4.c+22 -00 replies
8/18thunderbolt: Move tb_plug_events_active() before tb_switch_reset_host()drivers/thunderbolt/switch.c+40 -400 replies
9/18thunderbolt: Add tb_port_state_is_up()drivers/thunderbolt/switch.c+19 -80 replies
10/18thunderbolt: Split host router port reset into a separate functiondrivers/thunderbolt/switch.c+49 -390 replies
11/18thunderbolt: Reset topology after suspend-to-diskdrivers/thunderbolt/domain.c drivers/thunderbolt/nhi.c drivers/thunderbolt/switch.c +3 more+155 -430 replies
12/18thunderbolt: Drop tunnel discovery without HopID allocationdrivers/thunderbolt/path.c drivers/thunderbolt/tb.c drivers/thunderbolt/tb.h +2 more+37 -590 replies
13/18thunderbolt: Always take domain lock when tb_tunnel_put() is calleddrivers/thunderbolt/tunnel.c+8 -80 replies
14/18thunderbolt: Assign domain to the routers in KUnit testsdrivers/thunderbolt/test.c+23 -00 replies
15/18thunderbolt: Rework tunnel credit allocationdrivers/thunderbolt/Makefile drivers/thunderbolt/credits.c drivers/thunderbolt/debugfs.c +6 more+1290 -3891 reply
16/18thunderbolt: Add support for shared flow controldrivers/thunderbolt/credits.c drivers/thunderbolt/debugfs.c drivers/thunderbolt/path.c +4 more+279 -630 replies
17/18thunderbolt: Use restricted shared flow control for DMA tunnels on intra-domain linksdrivers/thunderbolt/tunnel.c+30 -10 replies
18/18thunderbolt: Add KUnit tests for shared bufferingdrivers/thunderbolt/test.c+598 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/18] thunderbolt: Add support for shared buffering

Hi all,

Currently all DMA tunnels (over XDomain) use dedicated flow control meaning that each consumes fixed amount of buffers from a router ingress adapter. This becomes problematic if the DMA tunnel is routed through a device router because that may involve other tunnels like native ones that take away their share of buffers. The current scheme is such that we allocate full credits for USB3/PCIe, some for DMA and the rest goes for DisplayPort. On Intel hardware this means the first DMA tunnel gets full buffers and the second one gets one and after that we run out.

This series reworks the credit allocation so that there is still reserve but a smaller one. For DP we allocate as much as there are DP INs on in the host router, then minimum for USB3/PCIe/DMA. Everything else goes to common pool that is first come first served.

Then we add support for shared buffering and lastly enable them for DMA tunnels over intra-domain links. This allows more DMA tunnels to share a link. The inter-domain link stays using the dedicated flow control.

The other patches before the credit work are needed because they fix a long standing issue around suspend to disk. The topology is now reset on restore so DP resources the restore kernel left behind are no longer leaked. That would otherwise affect the credits too.

Gil Fine (2):
thunderbolt: Add support for shared flow control
thunderbolt: Use restricted shared flow control for DMA tunnels on intra-domain links

Mika Westerberg (Intel) (16):
thunderbolt: Avoid leaking of DMA tunnel after XDomain removal
thunderbolt: Tear down DMA tunnels on every XDomain removal
thunderbolt: Delay re-pairing DP IN/OUT if DPRX negotiation fails
thunderbolt: Call DP tunnel activation callback with tb->lock held
thunderbolt: Re-apply Alpine/Titan Ridge flow on resume
thunderbolt: Return -ESHUTDOWN when control channel is not running
thunderbolt: Add usb4_port_hotplug_disable()
thunderbolt: Move tb_plug_events_active() before tb_switch_reset_host()
thunderbolt: Add tb_port_state_is_up()
thunderbolt: Split host router port reset into a separate function
thunderbolt: Reset topology after suspend-to-disk
thunderbolt: Drop tunnel discovery without HopID allocation
thunderbolt: Always take domain lock when tb_tunnel_put() is called
thunderbolt: Assign domain to the routers in KUnit tests
thunderbolt: Rework tunnel credit allocation
thunderbolt: Add KUnit tests for shared buffering

 drivers/thunderbolt/Makefile  |    2 +-
 drivers/thunderbolt/credits.c |  685 ++++++++++++++++++++
 drivers/thunderbolt/ctl.c     |    4 +-
 drivers/thunderbolt/debugfs.c |   43 ++
 drivers/thunderbolt/domain.c  |    5 +-
 drivers/thunderbolt/nhi.c     |   17 +-
 drivers/thunderbolt/path.c    |  101 +--
 drivers/thunderbolt/switch.c  |  374 ++++++++---
 drivers/thunderbolt/tb.c      |  201 +++---
 drivers/thunderbolt/tb.h      |  200 ++++--
 drivers/thunderbolt/tb_regs.h |    2 +
 drivers/thunderbolt/test.c    | 1106 +++++++++++++++++++++++++++++++--
 drivers/thunderbolt/tunnel.c  |  495 +++++----------
 drivers/thunderbolt/tunnel.h  |    7 +-
 drivers/thunderbolt/usb4.c    |   28 +-
 15 files changed, 2601 insertions(+), 669 deletions(-)
 create mode 100644 drivers/thunderbolt/credits.c
Signature · 1 line
2.50.1