eth_get_headlen(9)
π 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 aconst struct net_device *.dataβ pointer to start of frame. the beginning. the main character of the buffer. it's aconst void *.lenβ total length of frame. the whole thing, top to bottom, au32.
π§ 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:
eth_header(9)eth_type_trans(9)eth_header_cache(9)eth_header_cache_update(9)eth_header_parse_protocol(9)eth_prepare_mac_addr_change(9)eth_commit_mac_addr_change(9)eth_mac_addr(9)ether_setup(9)alloc_etherdev_mqs(9)platform_get_ethdev_address(9)nvmem_get_mac_address(9)fwnode_get_mac_address(9)device_get_mac_address(9)device_get_ethdev_address(9)
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
- 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