STRUCT IAVF_STATS(9)
π¦ struct iavf_stats(9) β Kernel API Manual π¦
okay bestie, so this is a page from the Kernel API Manual and it's literally all about struct iavf_stats β the little glow-up blueprint for, and I quote, "definition for an ethtool statistic" β¨ yes ma'am, that's the whole vibe.
πΈ NAME πΈ
struct iavf_stats β the definition for an ethtool statistic. that's it, that's the name, she's simple but she's iconic π
β¨ SYNOPSIS β¨
struct iavf_stats {
char stat_string[ETH_GSTRING_LEN];
int sizeof_stat;
int stat_offset;
};
look at her. three little fields, zero drama, all business π«Ά
π Members π
stat_stringβ the statistic name that gets displayed in theethtool -Soutput. it's the label bestie, the little nametag πsizeof_statβ literally thesizeofthe stat itself. rule of the house: it must be no greater thansizeof(u64). don't push it πstat_offsetβ theoffsetofof the stat from a base pointer. it's giving "where am I relative to home" π§
π Description π
so this structure is what defines a statistic that gets added to the ethtool stats buffer. it defines a statistic as an offset from a common base pointer β that's the whole trick, iykyk π«
stats should be defined in constant arrays using the IAVF_STAT macro, and listen: every single element of that array has to use the same _type for calculating sizeof_stat and stat_offset. no mixing, no chaos, we're consistent in this household periodt π
the sizeof_stat is expected to be sizeof(u8), sizeof(u16), sizeof(u32) or sizeof(u64). those four, that's the squad. other sizes are not expected, and if you try it you will produce a WARN_ONCE from the iavf_add_ethtool_stat helper function π so like... don't. fr fr.
β οΈ heads up bestie β thestat_stringis interpreted as a format string, which means formatted values can get inserted while looping over multiple structures for a given statistics array. so every statistic string in an array should have the same type and number of format specifiers, to be formatted by variadic arguments to theiavf_add_stat_stringhelper function. same type, same count, no exceptions π«Ά
π SEE ALSO π
kernel file ./drivers/net/ethernet/intel/iavf/iavf_ethtool.c β go read the source, she's right there π
and the whole friend group, in order, no cap:
iavf_add_one_ethtool_stat(9)__iavf_add_ethtool_stats(9)iavf_add_ethtool_stats(9)iavf_add_queue_stats(9)__iavf_add_stat_strings(9)iavf_add_stat_strings(9)iavf_get_link_ksettings(9)iavf_get_sset_count(9)iavf_get_ethtool_stats(9)iavf_get_stat_strings(9)iavf_get_strings(9)iavf_get_msglevel(9)iavf_set_msglevel(9)iavf_get_drvinfo(9)iavf_get_ringparam(9)iavf_set_ringparam(9)__iavf_get_coalesce(9)iavf_get_coalesce(9)iavf_get_per_queue_coalesce(9)iavf_set_itr_per_queue(9)__iavf_set_coalesce(9)iavf_set_coalesce(9)iavf_set_per_queue_coalesce(9)iavf_fltr_to_ethtool_flow(9)iavf_ethtool_flow_to_fltr(9)iavf_is_mask_valid(9)iavf_parse_rx_flow_user_data(9)iavf_fill_rx_flow_ext_data(9)iavf_get_ethtool_fdir_entry(9)iavf_get_fdir_fltr_ids(9)iavf_add_fdir_fltr_info(9)iavf_add_fdir_ethtool(9)iavf_del_fdir_ethtool(9)iavf_set_rxnfc(9)iavf_get_rx_ring_count(9)iavf_get_rxnfc(9)iavf_get_channels(9)iavf_set_channels(9)iavf_get_rxfh_key_size(9)iavf_get_rxfh_indir_size(9)iavf_get_rxfh(9)iavf_set_rxfh(9)iavf_set_ethtool_ops(9)
and that's the whole page bestie, go forth and offset responsibly π
β§ο½₯οΎ: * sign-off time * :οΎο½₯β§ this lil masterpiece lives in ./drivers/net/ethernet/intel/iavf and it's dated October 2026 β struct iavf_stats(9), out π¦π
π¦ 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