STRUCT CAN_FRAME(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct can_frame(9) β€” the Kernel API Manual, but make it cute

okay bestie, welcome to struct can_frame(9) from the Kernel API Manual ✨ this is the page about the Classical CAN frame structure, aka CAN 2.0B β€” like, the OG CAN frame, the blueprint, the blueprint-that-ate 🫢


✨ NAME ✨

struct can_frame β€” Classical CAN frame structure (aka CAN 2.0B) πŸ’–


🌸 SYNOPSIS 🌸

here's the whole thing, character for character, no cap:

struct can_frame {
    canid_t can_id;
    union {
      __u8 len;
      __u8 can_dlc;
    };
    __u8 __pad;
    __u8 __res0;
    __u8 len8_dlc;
    __u8 data[CAN_MAX_DLEN];
 };

like… look at her. iconic. πŸŽ€


πŸ¦‹ Members πŸ¦‹

  • can_id β€” the CAN ID of the frame plus the CAN_*_FLAG flags. for the full deets, go look at the canid_t definition πŸ‘‘
  • {unnamed_union} β€” it's an anonymous union, bestie. no name, all main character energy πŸ’…
  • len β€” CAN frame payload length in byte, 0 .. 8 ✨
  • can_dlc β€” deprecated name for CAN frame payload length in byte, 0 .. 8. yeah she's still here, but she's deprecated, so, yk, use len πŸ™ˆ
  • __pad β€” padding πŸ›‹οΈ
  • __res0 β€” reserved / padding
  • len8_dlc β€” the optional DLC value (9 .. 15) when the payload length is 8 bytes. so like, len8_dlc contains values from 9 .. 15 when the payload length is 8 bytes but the DLC value (see ISO 11898-1) is greater then 8. ⚠️ important: the CAN_CTRLMODE_CC_LEN8_DLC flag has to be enabled in the CAN driver for this to work, fr fr.
  • data β€” CAN frame payload (up to 8 byte) πŸ“
lowkey read the len8_dlc one twice, bestie β€” the "greater then 8" and the "flag has to be enabled in CAN driver" bits are the whole point 🫢

🌈 SEE ALSO 🌈

  • Kernel file ./include/uapi/linux/can.h
  • struct canfd_frame(9)
  • struct canxl_frame(9)
  • struct sockaddr_can(9)
  • struct can_filter(9)

like, go read them, they're all in the same friend group πŸ’œ


and that's the whole page, bestie! 🧚 this one lives at ./include/uapi/linux in the kernel tree, from October 2026 β€” and the page title is struct can_frame(9), in case you forgot already 😭 slay, go forth and parse those frames πŸ‘‘πŸ’–

πŸ“¦ where this page comes from