STRUCT ETHTOOL_CMD(9)
πΈ struct ethtool_cmd(9) β the Kernel API Manual, but make it make sense πΈ
okay bestie, sit down, grab a boba, because we're talking about struct ethtool_cmd from the Linux kernel API manual. and listen β she's gorgeous, she's historic, and she is, unfortunately, DEPRECATED ππ like a limited-edition item that got discontinued. this whole structure is DEPRECATED, so please, for the love of everything, use struct ethtool_link_settings instead. periodt. π
β¨ NAME β¨
struct ethtool_cmd β DEPRECATED, link control and status. This structure is DEPRECATED, please use struct ethtool_link_settings. (yes i said it twice, it's important, don't @ me π)
π¦ SYNOPSIS π¦
here's the whole fit, laid out:
struct ethtool_cmd {
__u32 cmd;
__u32 supported;
__u32 advertising;
__u16 speed;
__u8 duplex;
__u8 port;
__u8 phy_address;
__u8 transceiver;
__u8 autoneg;
__u8 mdio_support;
__u32 maxtxpkt;
__u32 maxrxpkt;
__u16 speed_hi;
__u8 eth_tp_mdix;
__u8 eth_tp_mdix_ctrl;
__u32 lp_advertising;
__u32 reserved[2];
};
π Members π
okay now the cast of characters, one by one, no skipping π
cmdβ the command number, and it's eitherETHTOOL_GSETorETHTOOL_SSET. that's it. that's the whole vibe check.supportedβ a bitmask ofSUPPORTED_*flags covering the link modes, physical connectors and other link features that this interface actually supports autonegotiation or auto-detection for. read-only, so don't even try it, bestie. πadvertisingβ a bitmask ofADVERTISED_*flags for the link modes, physical connectors and other link features that are advertised through autonegotiation, or enabled for auto-detection. it's giving "what i'm putting on my profile" energy β¨speedβ the low bits of the speed, in 1Mb units, ranging0toINT_MAXorSPEED_UNKNOWN. lowkey only half the story, more on that in a sec πduplexβ duplex mode; one ofDUPLEX_*portβ physical connector type; one ofPORT_*phy_addressβ the MDIO address of the PHY (transceiver);0or255if it's not applicable. for clause 45 PHYs this is the PRTAD. fancy πtransceiverβ historically used to tell different possible PHY types apart, but honestly not in a consistent way. Deprecated. we don't stan anymore πautonegβ enable/disable autonegotiation and auto-detection; eitherAUTONEG_DISABLEorAUTONEG_ENABLE. the on/off switch of the whole situation π₯mdio_supportβ a bitmask ofETH_MDIO_SUPPORTS_*flags for the MDIO protocols the interface supports;0if it's unknown. read-only. πmaxtxpktβ historically used to report TX IRQ coalescing; now obsoleted bystruct ethtool_coalesce. read-only; deprecated. she had her moment, she's retired πmaxrxpktβ historically used to report RX IRQ coalescing; now obsoleted bystruct ethtool_coalesce. read-only; deprecated. same energy, other direction π«Άspeed_hiβ the high bits of the speed, in 1Mb units,0toINT_MAXorSPEED_UNKNOWN. see? i told youspeedwas only half of it πeth_tp_mdixβ Ethernet twisted-pair MDI(-X) status; one ofETH_TP_MDI_*. if the status is unknown or not applicable, the value will beETH_TP_MDI_INVALID. read-only. πeth_tp_mdix_ctrlβ Ethernet twisted pair MDI(-X) control; one ofETH_TP_MDI_*. if MDI(-X) control isn't implemented, reads yieldETH_TP_MDI_INVALIDand writes may be ignored or rejected. when written successfully, the link should be renegotiated if necessary. no cap, that last part matters πlp_advertisingβ a bitmask ofADVERTISED_*flags for the link modes and other link features that the link partner advertised through autonegotiation;0if unknown or not applicable. read-only. that's your partner's profile, not yours πβ¨reservedβ reserved for future use; see the note on reserved space. mind your business, it's not for you yet π
π Description π
so the link speed in Mbps is split between speed and speed_hi. yes, split, like a friendship bracelet. π«Ά use the ethtool_cmd_speed and ethtool_cmd_speed_set functions to actually access it β do not go poking at the halves yourself, i'm begging.
if autonegotiation is disabled, speed and duplex represent the fixed link mode and are writable if the driver supports multiple link modes. if autonegotiation is enabled, then they're read-only β and:
- if the link is up, they represent the negotiated link mode πΈ
- if the link is down, the speed is
0,SPEED_UNKNOWNor the highest enabled speed, and duplex isDUPLEX_UNKNOWNor the best enabled duplex mode. π it's giving "we tried our best"
some hardware interfaces may have multiple PHYs and/or physical connectors fitted, or they just don't let the driver detect which are fitted. for these interfaces port and/or phy_address may be writable, possibly dependent on autoneg being AUTONEG_DISABLE. otherwise, attempts to write different values may be ignored or rejected β so like, don't be shocked, bestie π
users should assume that all fields not marked read-only are writable and subject to validation by the driver. so if you write something unhinged and it gets rejected, that's on you, not the kernel. π
the correct move, always: use ETHTOOL_GSET to get the current values first, then make your specific changes, then apply them with ETHTOOL_SSET. get β tweak β set. that's the whole choreography π
π₯
and Deprecated fields should be ignored by both users and drivers. both. everyone. ignore them. periodt. π
β SEE ALSO β
go read the Kernel file ./include/uapi/linux/ethtool.h, plus literally the entire extended universe: 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_test(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).
that's the whole group chat, all tagged. iykyk π§π
mwah, that's the whole page! π«Ά this lil love letter lives in ./include/uapi/linux, dated October 2026, and it's filed under struct ethtool_cmd(9) β go stan struct ethtool_link_settings instead tho, fr fr π
β¨
π¦ 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