STRUCT ETHTOOL_TEST(9)
πΈ NAME πΈ
struct ethtool_test β device self-test invocation π
(yes, the actual "hey bestie, run a self-test on this NIC" struct)
β¨ SYNOPSIS β¨
struct ethtool_test {
__u32 cmd;
__u32 flags;
__u32 reserved;
__u32 len;
__u64 data[];
};
Okay so this is the struct, it's giving very "header + flexible array member" realness, and here's what each little field is doing π
π MEMBERS π
π cmd
Command number = ETHTOOL_TEST. That's the whole vibe β this is the magic number that tells the kernel "hi, we're doing the self-test thing today."
π flags
A bitmask of flags from enum ethtool_test_flags. Some flags may be set by the user on entry; others may be set by the driver on return. So it's a two-way conversation, not a monologue β lowkey iconic π«Ά
π¦ reserved
Reserved for future use; see the note on reserved space. Bestie, do not touch this. It's saving its seat for future main character energy π
π₯ len
On return, the number of test results. So you don't know it going in β the kernel tells you on the way out. Surprise reveal, we love that for you β¨
π data
Array of test results. The payload! The moment! The whole point!
π DESCRIPTION π
Okay so here's the tea β β users must use ETHTOOL_GSSET_INFO or ETHTOOL_GDRVINFO to find the number of test results that will be returned.
Then (and this is the part people always mess up, ngl) they must allocate a buffer of the appropriate size (8 * number of results) immediately following this structure. Immediately. Right after it. Not on a different allocation, not off in a corner β it lives right up against this struct, no cap π«Ά
So the mental picture is: this struct, and then 8 * number of results bytes of results trailing behind it like a little squad β¨
Not me emphasizing "immediately following this structure" twice β it's because that's literally the whole design, bestie. Respect the layout π
π SEE ALSO π
Kernel file ./include/uapi/linux/ethtool.h β and a whole friend group of structs/enums:
struct ethtool_cmd(9)struct ethtool_drvinfo(9)struct ethtool_wolinfo(9)struct ethtool_regs(9)struct ethtool_eeprom(9)struct ethtool_eee(9)struct ethtool_modinfo(9)struct ethtool_coalesce(9)struct ethtool_ringparam(9)struct ethtool_channels(9)struct ethtool_pauseparam(9)enum ethtool_stringset(9)enum ethtool_mac_stats_src(9)enum ethtool_module_power_mode_policy(9)enum ethtool_module_power_mode(9)enum ethtool_c33_pse_ext_state(9)enum ethtool_c33_pse_ext_substate_mr_mps_valid(9)enum ethtool_c33_pse_ext_substate_error_condition(9)enum ethtool_c33_pse_ext_substate_mr_pse_enable(9)enum ethtool_c33_pse_ext_substate_option_detect_ted(9)enum ethtool_c33_pse_ext_substate_option_vport_lim(9)enum ethtool_c33_pse_ext_substate_ovld_detected(9)enum ethtool_c33_pse_ext_substate_power_not_available(9)enum ethtool_c33_pse_ext_substate_short_detected(9)enum ethtool_pse_types(9)enum ethtool_c33_pse_admin_state(9)enum ethtool_c33_pse_pw_d_status(9)enum ethtool_podl_pse_admin_state(9)enum ethtool_podl_pse_pw_d_status(9)enum ethtool_mm_verify_status(9)enum ethtool_module_fw_flash_status(9)struct ethtool_gstrings(9)struct ethtool_sset_info(9)enum ethtool_test_flags(9)struct ethtool_stats(9)struct ethtool_perm_addr(9)struct ethtool_tcpip4_spec(9)struct ethtool_ah_espip4_spec(9)struct ethtool_usrip4_spec(9)struct ethtool_tcpip6_spec(9)struct ethtool_ah_espip6_spec(9)struct ethtool_usrip6_spec(9)struct ethtool_flow_ext(9)struct ethtool_rx_flow_spec(9)struct ethtool_rxnfc(9)struct ethtool_rxfh_indir(9)struct ethtool_rxfh(9)struct ethtool_rx_ntuple_flow_spec(9)struct ethtool_rx_ntuple(9)struct ethtool_dump(9)struct ethtool_get_features_block(9)struct ethtool_gfeatures(9)struct ethtool_set_features_block(9)struct ethtool_sfeatures(9)struct ethtool_ts_info(9)struct ethtool_per_queue_op(9)struct ethtool_fecparam(9)enum ethtool_fec_config_bits(9)struct ethtool_link_settings(9)enum phy_upstream(9)
And that's the whole page, bestie! π§ Signing off from ./include/uapi/linux, dated October 2026 β go run that self-test, allocate 8 * number of results bytes right after the struct, and slay πβ¨
π¦ 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