STRUCT TB_XDOMAIN(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ struct tb_xdomain β€” Cross-domain (XDomain) connection πŸ’œ

okay so this is a page straight out of the Kernel API Manual, and it's all about struct tb_xdomain, bestie. it's giving "two hosts, one very cute connection" energy. let's get into it ✨


✨ SYNOPSIS ✨

struct tb_xdomain {
    struct device dev;
    struct tb *tb;
    uuid_t *remote_uuid;
    const uuid_t *local_uuid;
    u64 route;
    u16 vendor;
    u16 device;
    unsigned int local_max_hopid;
    unsigned int remote_max_hopid;
    struct mutex lock;
    const char *vendor_name;
    const char *device_name;
    unsigned int link_speed;
    enum tb_link_width link_width;
    bool link_usb4;
    bool is_unplugged;
    bool removing;
    bool needs_uuid;
    struct ida service_ids;
    struct ida in_hopids;
    struct ida out_hopids;
    u32 *local_property_block;
    u32 local_property_block_gen;
    u32 local_property_block_len;
    struct tb_property_dir *remote_properties;
    u32 remote_property_block_gen;
    int state;
    struct delayed_work state_work;
    int state_retries;
    struct delayed_work properties_changed_work;
    int properties_changed_retries;
    bool bonding_possible;
    u8 target_link_width;
    atomic_t ntunnels;
    u8 link;
    u8 depth;
 };

🫢 MEMBERS 🫢

like, every single field, no skips, fr fr πŸ‘‘

  • dev β€” the XDomain device itself, main character energy
  • tb β€” pointer to the domain
  • remote_uuid β€” the UUID of the remote domain (the host)
  • local_uuid β€” our own UUID, cached so we don't gotta go fetch it again πŸ’…
  • route β€” the route string the other domain can be reached at
  • vendor β€” vendor ID of the remote domain
  • device β€” device ID of the demote domain
  • local_max_hopid β€” maximum input HopID of this host
  • remote_max_hopid β€” maximum input HopID of the remote host
  • lock β€” the lock that serializes access to the following fields of this structure (yes bestie, the following ones β€” respect the lock or perish 😭)
  • vendor_name β€” name of the vendor (or NULL if it's not known)
  • device_name β€” name of the device (or NULL if it's not known)
  • link_speed β€” speed of the link, in Gb/s
  • link_width β€” width of the downstream facing link
  • link_usb4 β€” is the downstream link USB4? this flag says yes/no ✨
  • is_unplugged β€” the XDomain is unplugged 🫠
  • removing β€” set by tb_xdomain_remove under lock, so concurrent delayed work queueing can't sneak in
  • needs_uuid β€” if the XDomain doesn't have a remote_uuid, it will be queried first
  • service_ids β€” used to generate IDs for the services
  • in_hopids β€” input HopIDs for DMA tunneling
  • out_hopids β€” output HopIDs for DMA tunneling
  • local_property_block β€” local block of properties
  • local_property_block_gen β€” generation of local_property_block
  • local_property_block_len β€” length of the local_property_block, in dwords
  • remote_properties β€” properties exported by the remote domain
  • remote_property_block_gen β€” generation of remote_properties
  • state β€” next XDomain discovery state to run
  • state_work β€” work used to run the next state
  • state_retries β€” number of retries remain for the state
  • properties_changed_work β€” work used to notify the remote domain that our properties have changed
  • properties_changed_retries β€” number of times left to send the properties changed notification
  • bonding_possible β€” true if lane bonding is possible on the local side
  • target_link_width β€” target link width from the remote host
  • ntunnels β€” keeps track of how many tunnels go through this XDomain
  • link β€” root switch link the remote domain is connected to (ICM only)
  • depth β€” depth in the chain the remote domain is connected at (ICM only)

🌸 DESCRIPTION 🌸

okay so real talk: this structure represents a connection across two domains (hosts). each XDomain contains zero or more services, and those services get exposed as struct tb_service objects. slay 🌈

service drivers may access this structure if they need to enumerate non-standard properties β€” but they need to hold lock when doing so, because properties can be changed asynchronously in response to changes in the remote domain. no cap, do not skip the lock πŸ™ˆ


πŸ¦‹ SEE ALSO πŸ¦‹

go read these next, i'm obsessed with the whole crew πŸ’–

Kernel file ./include/linux/thunderbolt.h, enum tb_security_level(9), struct tb(9), struct tb_property_dir(9), struct tb_property(9), enum tb_link_width(9), struct tb_protocol_handler(9), struct tb_service(9), struct tb_service_driver(9), struct tb_nhi(9), struct tb_ring(9), enum ring_desc_flags(9), struct ring_frame(9), tb_ring_rx(9), tb_ring_tx(9), tb_ring_dma_device(9)


and that's the whole page bb πŸŽ€ it lives in ./include/linux, dated October 2026 β€” go forth and tunnel responsibly, ily πŸ’œπŸ¦‹

πŸ“¦ where this page comes from