STRUCT FW_MAC(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 struct fw_mac(9) β€” the Kernel API Manual, but make it make sense 🌸

okay bestie, welcome to struct fw_mac(9) β€” this is a page from the kernel API manual, and it's literally all about one struct. no cap, that's the whole vibe.


✨ NAME ✨

struct fw_mac β€” a firmware block used by RTL_FW_PLA and RTL_FW_USB. and the layout of the firmware block is, in this exact order:

<struct fw_mac> + <info> + <firmware data>

so it's giving "header, then little info note, then the actual firmware goodies" πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

here's the whole struct, character for character, don't touch:

struct fw_mac {
    struct fw_block blk_hdr;
    __le16 fw_offset;
    __le16 fw_reg;
    __le16 bp_ba_addr;
    __le16 bp_ba_value;
    __le16 bp_en_addr;
    __le16 bp_en_value;
    __le16 bp_start;
    __le16 bp_num;
    __le16 bp[16];
    __le32 reserved;
    __le16 fw_ver_reg;
    u8 fw_ver_data;
    char info[];
};

the way this is just a whole little neighborhood of fields… obsessed 🫢


πŸ¦‹ Members πŸ¦‹

  • blk_hdr β€” the firmware descriptor. it's got the type and the length, so like, the ID card of the block πŸͺͺ
  • fw_offset β€” the offset of the firmware binary data. the start address of that data would be the address of struct fw_mac + fw_offset. do the math, bestie ✨
  • fw_reg β€” the register to load the firmware into. depends on chip, so no universal answer, iykyk.
  • bp_ba_addr β€” the register you write the break point base address to. depends on chip.
  • bp_ba_value β€” the break point base address itself. depends on chip.
  • bp_en_addr β€” the register to write the break point enabled mask to. depends on chip.
  • bp_en_value β€” the break point enabled mask. this one depends on the firmware, not the chip β€” main character energy tbh πŸ‘‘
  • bp_start β€” the start register of the break points. depends on chip.
  • bp_num β€” the break point number that needs to be set for this firmware. depends on the firmware.
  • bp β€” the break points. depends on firmware. yes it's an array of 16, and yes that's a lot of break points, slay πŸ’€
  • reserved β€” reserved space. literally unused. it's just sitting there, vibing πŸ™ˆ
  • fw_ver_reg β€” the register to store the fw version.
  • fw_ver_data β€” the firmware version of the current type.
  • info β€” additional information for debugging, and it's followed by the binary data of firmware. so it's the little gossip note right before the payload 🌸
quick vibe check: half these fields say "Depends on chip" and the other half say "Depends on the firmware." that's not me being vague, that's the actual documentation. don't @ me 😭

🌈 SEE ALSO 🌈

go look at the kernel file ./drivers/net/usb/r8152.c, plus these iconic siblings:

  • struct fw_block(9)
  • struct fw_header(9)
  • struct fw_phy_patch_key(9)
  • struct fw_phy_nc(9)

and that's the page, bestie πŸŽ€ it lives in ./drivers/net/usb, dated October 2026, from the kernel API manual's struct fw_mac(9) edition. go read your structs, ily, bye πŸ’–βœ¨

πŸ“¦ where this page comes from