eth_get_headlen(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… eth_get_headlen(9) β€” the Kernel API Manual, section 9, bestie

okay so this is a kernel API page, which means it lives in section 9 of the manual (that's the <pink>eth_get_headlen(9)</pink> part β€” section 9 is the kernel API shelf, iykyk), and today we're learning how to find out how long an ethernet frame's headers are. no cap, that's the whole vibe. πŸ¦‹


✨ NAME ✨

eth_get_headlen β€” literally just "determine the length of header for an ethernet frame". that's it. that's the whole job. she's focused, she's employed, she's an icon. πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

u32 eth_get_headlen (const struct net_device *dev , const void *data ,
u32 len );

so she takes three things and hands you back a u32. copy it exactly, don't freestyle the types, the compiler WILL notice and it will not be cute. πŸ’€


🌸 ARGUMENTS 🌸

  • dev β€” pointer to network device. like, which netdev are we even talking about, bestie. it's a const struct net_device *.
  • data β€” pointer to start of frame. the beginning. the main character of the buffer. it's a const void *.
  • len β€” total length of frame. the whole thing, top to bottom, a u32.

🧚 DESCRIPTION 🧚

okay so here's the tea: this function makes a best effort attempt to pull the length for all of the headers for a given frame in a linear buffer.

read that again and clock the important bits, because they're doing so much work:

  • best effort attempt β€” she's trying her best, she's not promising you the world. it's an attempt, not a guarantee. so don't come for her if it's not perfect. 😭
  • all of the headers β€” not just one, the whole header stack. she's collecting them.
  • in a linear buffer β€” the frame is sitting contiguously, no scattered fragments, thank u.

and that's the entire description. short, sweet, and honestly kind of iconic. ✨


πŸ”₯ SEE ALSO πŸ”₯

the kernel file she lives in: ./net/ethernet/eth.c β€” go say hi, she's lovely. 🫢

and here's the whole ethernet entourage, every single one, no skipping, I see you:

that's fifteen friends. the whole group chat. πŸ’–


heads up bestie: the synopsis in the original is laid out across two lines exactly like the code block above β€” if you're copying it somewhere, keep it character for character. ✨

mwah πŸ’‹ that's the page! this one ships out of ./net/ethernet and it's dated October 2026, which is lowkey in the future but she's built different like that. go read some header lengths, you absolute legend. πŸŒˆπŸ‘‘

πŸ“¦ where this page comes from