STRUCT IWL_CMD_HEADER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct iwl_cmd_header β€” the short command header format, bestie

okay so this is struct iwl_cmd_header from the Kernel API Manual, and it's literally the little header that kicks off every command and every response in iwlwifi land. it's short, it's cute, it's iconic. let's get into it πŸŽ€


✨ NAME ✨

struct iwl_cmd_header β€” the (short) command header format. yes bestie, "short" is doing real work in that sentence, we'll get to why 🫢


🌸 SYNOPSIS 🌸

struct iwl_cmd_header {
    u8 cmd;
    u8 group_id;
    __le16 sequence;
 };

three little fields, one big vibe. no cap ✨


πŸ¦‹ Members πŸ¦‹

  • cmd β€” the Command ID, like REPLY_RXON and friends. this is the "what am I even doing" field πŸ’…
  • group_id β€” the group ID, for commands that have groups. iykyk πŸ”₯
  • sequence β€” the sequence number for the command. lowkey the most interesting one, so buckle up πŸ“

🧚 the sequence field, explained

so the driver sets up the sequence number to values of its choosing. uCode does not use this value β€” but it does pass it back to the driver when it sends the response to each driver-originated command, so the driver can match the response to the command. it's giving "you dropped this, bestie" energy 🫢

and since the values don't actually get used by uCode, the driver may set up an arbitrary format. literally whatever it wants. main character freedom πŸ’…

there is one exception πŸ‘‘ β€” uCode sets bit 15 when it originates the response/notification, i.e. when the response/notification is not a direct response to a command sent by the driver. for example, uCode issues REPLY_RX when it sends a received frame to the driver; it is not a direct response to any driver command. so bit 15 is like the "this one's from me, not a reply" flag ✨

🌈 and the Linux driver uses this format:

0:7         tfd index - position within TX queue 8:12        TX queue id
13:14       reserved 15          unsolicited RX or uCode-originated
notification

so: bits 0:7 are the tfd index (position within the TX queue), 8:12 are the TX queue id, 13:14 are reserved, and bit 15 is the unsolicited RX or uCode-originated notification bit. obsessed with how it's all packed in there πŸŽ€


πŸ’– Description πŸ’–

this header format appears at the beginning of each command sent from the driver, and each response/notification received from uCode. that's it, that's the whole gig β€” it shows up first, every single time. it's the opening act, and honestly? it ate πŸ”₯


⭐ SEE ALSO ⭐

  • Kernel file ./drivers/net/wireless/intel/iwlwifi/fw/api/cmdhdr.h
  • Host command section(9)
  • struct iwl_cmd_header_wide(9)
  • struct iwl_calib_res_notif_phy_db(9)
  • struct iwl_phy_db_cmd(9)
  • struct iwl_cmd_response(9)

go read them, bestie, they're all connected πŸ¦‹


πŸ‘‘ sign-off πŸ‘‘

and that's the page, fr fr πŸ’œ β€” this was struct iwl_cmd_header(9) from the Kernel API Manual, sourced from ./drivers/net/wireless/intel/i..., dated October 2026. ty for coming to my ted talk, mwah πŸ’…πŸ’–

πŸ“¦ where this page comes from