tb_upstream_port(9)
β¨ tb_upstream_port(9) β¨
okay so real talk, this is a page from the Kernel API Manual about tb_upstream_port, and honestly? it's a little guy that does exactly one thing and does it cute. let's get into it bestie π
πΈ NAME πΈ
tb_upstream_port β return the upstream port of a switch
like literally that's the whole job. find the upstream port. slay.
π¦ SYNOPSIS π¦
struct tb_port * tb_upstream_port (struct tb_switch *sw );
π ARGUMENTS π
swβ Router π«Ά (yes, that's the whole description. the router. that's the vibe.)
π DESCRIPTION π
okay so here's the tea: every switch has an upstream port. every single one. and for the root switch, that upstream port is the NHI. iconic behavior honestly π
but here's the part you need to know, and i'm saying this with love: during switch alloc/init, tb_upstream_port->remote may be NULL, even for non-root switches. and on the NHI port, remote is always NULL. so likeβ¦ don't come for it when it's NULL, it's literally going through something π
no cap, check for that NULL before you go dereferencing, bestie. that's not me being dramatic, that's just the facts.
β RETURN β
Pointer to struct tb_port. π«
π SEE ALSO π
Kernel file ./drivers/thunderbolt/tb.h and the whole friend group:
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_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_port_on_path(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)
and that's the page!! π§ mwah π ok bye, this came from ./drivers/thunderbolt, dated October 2026 β go off, driver directory, we love you, periodt ππ₯
π¦ 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