tb_tunnel_discover_usb3(9)
π tb_tunnel_discover_usb3(9) β from the Kernel API Manual, bestie π
okay so picture this: you're deep in the kernel, right, and there's this thing called tb_tunnel_discover_usb3 and it is literally the function that goes looking for USB3 tunnels that already exist. not making new ones, not tearing them down β just finding the ones that are already out there living their truth. detective energy fr fr π΅οΈββοΈβ¨
β¨ NAME β¨
tb_tunnel_discover_usb3 β Discover existing USB3 tunnels π
like, the name says it all. discover. existing. USB3 tunnels. no cap.
πΈ SYNOPSIS πΈ
struct tb_tunnel * tb_tunnel_discover_usb3 (struct tb *tb , struct
tb_port *down , bool alloc_hopid );
yep that's the whole signature, exactly like that, line break and all π«Ά the way it returns a struct tb_tunnel *β¦ iconic.
π¦ ARGUMENTS π¦
tbβ Pointer to the domain structure π this is your domain, your whole world, the context everything lives in.downβ USB3 downstream adapter β¬οΈ the downstream one, specifically. not upstream. downstream. keep that straight bestie.alloc_hopidβ Allocate HopIDs from visited ports π this is abool, so it's yes-or-no vibes: do we grab HopIDs from the ports we visit or not.
π DESCRIPTION π
okay here's the whole deal, and it's honestly pretty short and sweet:
If down adapter is active, follows the tunnel to the USB3 upstream adapter and back. π
that's it. that's the function. if it's active β big if, the vibes check has to pass first β then it walks the tunnel all the way over to the USB3 upstream adapter and then comes right back. round trip. main character journey. periodt. π
β RETURN β
Pointer to struct tb_tunnel or NULL if there was no tunnel. π
so either you get a nice shiny pointer to a struct tb_tunnel, or you get NULL because there was, in fact, no tunnel. no tunnel, no pointer, no problem. always check for NULL, bestie, i'm begging π
π₯ SEE ALSO π₯
Kernel file ./drivers/thunderbolt/tunnel.c β that's the source of truth, go read it if you want the real real π
and then the whole friend group, in the order the manpage lists them:
tb_available_credits(9)tb_tunnel_event(9)tb_tunnel_discover_pci(9)tb_tunnel_alloc_pci(9)tb_tunnel_reserved_pci(9)tb_dp_bandwidth_mode_maximum_bandwidth(9)tb_tunnel_discover_dp(9)tb_tunnel_alloc_dp(9)tb_tunnel_alloc_dma(9)tb_tunnel_match_dma(9)tb_tunnel_alloc_usb3(9)tb_tunnel_is_invalid(9)tb_tunnel_activate(9)tb_tunnel_deactivate(9)tb_tunnel_port_on_path(9)tb_tunnel_maximum_bandwidth(9)tb_tunnel_allocated_bandwidth(9)tb_tunnel_alloc_bandwidth(9)tb_tunnel_consumed_bandwidth(9)tb_tunnel_release_unused_bandwidth(9)tb_tunnel_reclaim_available_bandwidth(9)
that's the whole circle. go say hi π«Άβ¨
ngl this one's a short read, so if you blinked you missed it. but every single argument, the return value, and the "is it active tho" condition are all right here β nothing skipped, nothing summarised π
and that's a wrap!! π this page lives under ./drivers/thunderbolt and it's dated October 2026, and the page itself is tb_tunnel_discover_usb3(9) in case you forgot where you were. slay, go read some tunnel source, ily, bye ππβ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms