tb_for_each_port_on_path(9)
π tb_for_each_port_on_path(9) β like, the actual Kernel API Manual, bestie β¨
okay so picture this: you're deep in the Thunderbolt driver, you're in ./drivers/thunderbolt/tb.h, and you need to look at every single port along a path. That's this. This is the one. This is tb_for_each_port_on_path(9) from the Kernel API Manual and honestly? iconic. π
β¨ NAME β¨
tb_for_each_port_on_path β iterate over each port on path π¦
like, one port at a time, all the way down the path. no cap.
π SYNOPSIS π
tb_for_each_port_on_path (src , dst , p );
three things go in, the walking happens, you get your ports. periodt. π
πΈ ARGUMENTS πΈ
srcβ the source port, aka where the path starts. our beginning. main character energy. πdstβ the destination port, aka where the path ends up. the whole point of the journey. βpβ the port that gets used as the iterator. it's the little guy that moves along while you loop, so don't go messing with it mid-iteration, iykyk. π₯
π DESCRIPTION π
It walks over each port on the path from src to dst. πΆββοΈ
That's it. That's the whole vibe. You give it a start, you give it an end, you give it an iterator, and it hands you the ports along the way one by one. lowkey perfect.
π«Ά SEE ALSO π«Ά
the whole friend group showed up, fr fr. everything below lives in the kernel file ./drivers/thunderbolt/tb.h:
struct tb_nvm(9)enum tb_switch_tmu_mode(9)struct tb_switch_tmu(9)struct tb_switch(9)struct tb_bandwidth_group(9)struct tb_port(9)struct usb4_port(9)struct tb_retimer(9)struct tb_path_hop(9)enum tb_path_port(9)struct tb_path(9)struct tb_cm_ops(9)tb_upstream_port(9)tb_is_upstream_port(9)tb_port_has_remote(9)tb_domain_event(9)tb_switch_for_each_port(9)tb_switch_downstream_port(9)tb_switch_depth(9)tb_switch_is_icm(9)tb_switch_tmu_is_configured(9)tb_switch_tmu_is_enabled(9)tb_switch_clx_is_enabled(9)tb_port_path_direction_downstream(9)tb_for_each_upstream_port_on_path(9)tb_path_for_each_hop(9)tb_downstream_route(9)tb_xdomain_downstream_port(9)usb4_switch_version(9)tb_switch_is_usb4(9)enum usb4_sb_target(9)enum usb4_margin_sw_error_counter(9)struct usb4_port_margining_params(9)
ok that's the whole page bestie, go iterate some ports responsibly π
and that's a wrap!! π this little gem comes from ./drivers/thunderbolt, dated October 2026, and it's tb_for_each_port_on_path(9) forever and always. mwah. πβ¨
π¦ 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