STRUCT IDPF_STATS(9)
π struct idpf_stats(9) β the Kernel API Manual, bestie edition
okay so real talk, today we're doing struct idpf_stats from the Kernel API Manual, and honestly? she's giving "definition for an ethtool statistic" and she's iconic for it. let's get into it π
β¨ NAME β¨
struct idpf_stats β the literal definition for an ethtool statistic. that's it, that's the girl π
πΈ SYNOPSIS πΈ
okay bestie, here's the shape of her, copy it exactly, no cap:
struct idpf_stats {
char stat_string[ETH_GSTRING_LEN];
int sizeof_stat;
int stat_offset;
};
π¦ Members π¦
stat_stringβ the statistic name you're gonna see displayed inethtool -Soutput. this is her name tag at the party β¨sizeof_statβ thesizeofof the stat, and it must be no greater thansizeof(u64). highkey a size limit, don't push it πstat_offsetβ theoffsetofof the stat from a base pointer. it's giving "where u at relative to the base" energy π§
π«Ά Description π«Ά
so this structure defines a statistic to be added to the ethtool stats buffer, mmkay? it defines a statistic as an offset from a common base pointer. that's the whole bit.
stats should be defined in constant arrays using the IDPF_STAT macro, and every single element of that array has to use the same _type so the sizeof_stat and stat_offset come out right. no mixing, no chaos, we stay consistent π
thesizeof_statis expected to besizeof(u8),sizeof(u16),sizeof(u32)orsizeof(u64). other sizes are not expected and will produce aWARN_ONCEfrom theidpf_add_ethtool_stathelper function. so like... don't do that π the kernel will literally yell at you.
and the stat_string? she's interpreted as a format string. that 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 the idpf_add_stat_string helper function. same type, same number of specifiers, every time β fr fr, that's the vibe check π
π SEE ALSO π
the kernel file: ./drivers/net/ethernet/intel/idpf/idpf_ethtool.c β
and the whole friend group, all here, all accounted for:
idpf_get_rx_ring_count(9)idpf_get_rxnfc(9)idpf_add_flow_steer(9)idpf_del_flow_steer(9)idpf_get_rxfh_key_size(9)idpf_get_rxfh_indir_size(9)idpf_get_rxfh(9)idpf_set_rxfh(9)idpf_get_channels(9)idpf_set_channels(9)idpf_get_ringparam(9)idpf_set_ringparam(9)__idpf_add_qstat_strings(9)idpf_add_qstat_strings(9)idpf_add_stat_strings(9)idpf_get_stat_strings(9)idpf_get_strings(9)idpf_get_sset_count(9)idpf_add_one_ethtool_stat(9)idpf_add_queue_stats(9)idpf_add_empty_queue_stats(9)idpf_add_port_stats(9)idpf_collect_queue_stats(9)idpf_get_ethtool_stats(9)idpf_find_rxq_vec(9)idpf_find_txq_vec(9)__idpf_get_q_coalesce(9)idpf_get_q_coalesce(9)idpf_get_coalesce(9)idpf_get_per_q_coalesce(9)__idpf_set_q_coalesce(9)idpf_set_q_coalesce(9)idpf_set_coalesce(9)idpf_set_per_q_coalesce(9)idpf_get_msglevel(9)idpf_set_msglevel(9)idpf_get_link_ksettings(9)idpf_get_timestamp_filters(9)idpf_get_ts_info(9)idpf_get_ts_stats(9)idpf_set_ethtool_ops(9)
and that's the whole page, bestie, you ate it up π
mwah π this one came from./drivers/net/ethernet/intel/idpf, dated October 2026, and it's beenstruct idpf_stats(9)the whole time. go be a main character inidpf_ethtool.cnow πβ¨
π¦ 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