tb_path_alloc(9)
π tb_path_alloc(9) β like, the kernel API manual, but make it make sense π¦
okay bestie, welcome to the tb_path_alloc(9) page from the Kernel API Manual β¨ this is the one that hands you a whole thunderbolt path between two ports, and honestly the way it does it is kind of iconic. no cap.
πΈ NAME πΈ
tb_path_alloc β allocate a thunderbolt path between two ports π
like, it literally makes you a path. between two ports. that's the whole vibe check.
β¨ SYNOPSIS β¨
struct tb_path * tb_path_alloc (struct tb *tb , struct tb_port *src ,
int src_hopid , struct tb_port *dst , int dst_hopid , int link_nr ,
const char *name );
seven arguments, one function, zero regrets. copy it exactly, bestie, we don't freestyle signatures here π
π ARGUMENTS π
tbβ the domain pointer. it's giving "main character energy" β everything else lives inside it πsrcβ source port of the path. where the journey starts πsrc_hopidβ the HopID used for the first ingress port in the path πdstβ destination port of the path. where we're headed, periodt π―dst_hopidβ the HopID used for the last egress port in the path πlink_nrβ the preferred link if there are dual links on the path βοΈ (dual links = two lanes, we love options)nameβ name of the path. give it a cute one, it deserves it π·οΈ
π DESCRIPTION π
so here's the tea, bestie: this creates a path between two ports, starting with the given src_hopid π«Ά
then it reserves HopIDs for each port. and no, they can't always be the same as src_hopid β lowkey they can absolutely be different, depending on how many HopIDs each port already has reserved π like, the ports are booked and busy. it works around that.
and if there are dual links on the path, it prioritizes using link_nr β but highkey it takes into account that the lanes may be bonded π₯ so it's not just blindly picking your fave link, it's being smart about it.
β RETURN β
returns a pointer to struct tb_path β¨
and if things go sideways? NULL in case of failure π not a crash, not a vibe, just NULL. check for it, bestie. always check for it. π
π¦ SEE ALSO π¦
- Kernel file
./drivers/thunderbolt/path.cπ β the whole friend group lives here tb_path_discover(9)πtb_path_free(9)ποΈ β the cleanup queentb_path_deactivate_hop(9)π€tb_path_activate(9)β‘tb_path_is_invalid(9)π© β vibe check for pathstb_path_port_on_path(9)π§
ngl, if you're allocating paths you should fr fr also know how to free them. tb_path_free(9) is right there in SEE ALSO for a reason π«Ά
and that's the page, bestie π
source and version: it's from ./drivers/thunderbolt, and the date on it is October 2026 β so yeah, it's a little from the future, but it ate and left no crumbs πβ¨π
π¦ 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