tb_upstream_port(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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:


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