can_frame_bits(9)
π can_frame_bits β a kernel API manual, but make it make sense
okay so bestie, welcome to the can_frame_bits(9) glow-up β¨ this little icon lives in the Kernel API Manual, and its whole job is honestly so real of it: it calculates the number of bits on the wire in a CAN frame. that's it. that's the gig. no cap. π
β¨ SYNOPSIS β¨
can_frame_bits (is_fd , is_eff , bitstuffing , intermission , data_len );
like, five args, all vibes, all important. let's meet them π«Ά
πΈ ARGUMENTS πΈ
is_fdβ drop atruehere if we're talking CAN-FD frame, orfalseif it's a Classical CAN frame. pick your era bestie πis_effβtruemeans Extended frame,falsemeans Standard frame. extended is giving main character energy, standard is giving classic icon, both slay.bitstuffingβtrue= calculate the bitstuffing worst case πfalse= calculate the bitstuffing best case (aka no dynamic bitstuffing). and listen, CAN-FD's fixed stuff bits are always included no matter which one you pick β them bits are non-negotiable, periodt. βintermissionβ if and only if this istrue, include the inter frame space assuming no bus idle (so like, only the intermission). lowkey important caveat: strictly speaking, the inter frame space is not part of the frame. but bestie, you still need it when you're calculating the delay between the Start Of Frame of two consecutive frames. iykyk π¦data_lenβ length of the data field, in bytes. this corresponds tocan(fd)_frame->len. should be zero for remote frames. also heads up: no sanitization is done ondata_lenand it shall have no side effects. so like, it trusts you completely, don't betray it π
π RETURN π
the numbers of bits on the wire of a CAN frame. that's the whole return value, queen. go off. π
π SEE ALSO π
- Kernel file
./include/linux/can/length.h can_bitstuffing_len(9)
ngl, if you're computing delays between consecutive frames and you forgot intermission, the vibes will be off and the math will be off too. just saying. π
and that's the page!! this one ships out of ./include/linux/can, dated October 2026, and it's can_frame_bits(9) all day every day π§ mwah, go read the source, ily, bye!! π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms