STRUCT ETHTOOL_LINK_SETTINGS(9)
β¨ struct ethtool_link_settings(9) β¨
okay so bestie, welcome to the Kernel API Manual π this is the page for struct ethtool_link_settings β literally the whole link control + status situation. buckle up, she's thorough.
π NAME π
struct ethtool_link_settings β link control and status. that's it, that's the vibe. π
π¦ SYNOPSIS π¦
struct ethtool_link_settings {
__u32 cmd;
__u32 speed;
__u8 duplex;
__u8 port;
__u8 phy_address;
__u8 autoneg;
__u8 mdio_support;
__u8 eth_tp_mdix;
__u8 eth_tp_mdix_ctrl;
__s8 link_mode_masks_nwords;
__u8 transceiver;
__u8 master_slave_cfg;
__u8 master_slave_state;
__u8 rate_matching;
__u32 reserved[7];
#ifndef __KERNEL__;
__u32 link_mode_masks[];
#endif;
};
no cap, that's the whole struct, character for character. π«Ά
π Members π
cmdβ the command number, and it's literallyETHTOOL_GLINKSETTINGSorETHTOOL_SLINKSETTINGS. pick one, she's not flexible. πspeedβ link speed, in Mbps.duplexβ duplex mode; one of theDUPLEX_*values.portβ physical connector type; one of thePORT_*values.phy_addressβ MDIO address of the PHY (aka the transceiver);0or255if it's not applicable. for clause 45 PHYs this is the PRTAD. iykyk. πautonegβ turns autonegotiation and auto-detection on/off; eitherAUTONEG_DISABLEorAUTONEG_ENABLE.mdio_supportβ bitmask ofETH_MDIO_SUPPORTS_*flags for the MDIO protocols this interface supports;0if unknown. read-only, so don't even try it. πeth_tp_mdixβ Ethernet twisted-pair MDI(-X) status; one of theETH_TP_MDI_*values. if the status is unknown or not applicable, the value will beETH_TP_MDI_INVALID. also read-only. πeth_tp_mdix_ctrlβ Ethernet twisted pair MDI(-X) control; one of theETH_TP_MDI_*values. if MDI(-X) control isn't implemented, reads yieldETH_TP_MDI_INVALIDand writes may be ignored or rejected. when it is written successfully, the link should be renegotiated if necessary. ok queen, do your thing. β¨link_mode_masks_nwordsβ and she comes with a whole little family:- supported: bitmap where each bit's meaning is given by
ethtool_link_mode_bit_indices, covering the link modes, physical connectors and other link features for which the interface supports autonegotiation or auto-detection. read-only. - advertising: bitmap where each bit's meaning is given by
ethtool_link_mode_bit_indices, covering the link modes, physical connectors and other link features that are advertised through autonegotiation or enabled for auto-detection. - lp_advertising: bitmap where each bit's meaning is given by
ethtool_link_mode_bit_indices, covering the link modes and other link features that the link partner advertised through autonegotiation;0if unknown or not applicable. read-only.
- supported: bitmap where each bit's meaning is given by
transceiverβ used to distinguish different possible PHY types, reported consistently by PHYLIB. read-only bestie, hands off. πΈmaster_slave_cfgβ master/slave port mode.master_slave_stateβ master/slave port state.rate_matchingβ rate adaptation performed by the PHY.reservedβ reserved for future use; see the note on reserved space. (yes, the ominous note. it's giving β¨mysteryβ¨)link_mode_masksβ variable length bitmaps.
π Description π
IMPORTANT, Backward compatibility notice: when you're implementing new user-space tools, please first tryETHTOOL_GLINKSETTINGS, and if it succeeds useETHTOOL_SLINKSETTINGSto change link settings β do not useETHTOOL_SSETifETHTOOL_GLINKSETTINGSsucceeded: stick toETHTOOL_GLINKSETTINGS/SLINKSETTINGSin that case. conversely, ifETHTOOL_GLINKSETTINGSfails, useETHTOOL_GSETto query andETHTOOL_SSETto change link settings β do not useETHTOOL_SLINKSETTINGSifETHTOOL_GLINKSETTINGSfailed: stick toETHTOOL_GSET/ETHTOOL_SSETin that case. fr fr, pick a lane and stay in it. π
if autonegotiation is disabled, the speed and duplex represent the fixed link mode and are writable if the driver supports multiple link modes. if it's enabled then they're read-only β if the link is up they represent the negotiated link mode; if the link is down, the speed is 0, SPEED_UNKNOWN or the highest enabled speed, and duplex is DUPLEX_UNKNOWN or the best enabled duplex mode. she contains multitudes. π
some hardware interfaces may have multiple PHYs and/or physical connectors fitted, or 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. rude, but okay. π
deprecated ethtool_cmd fields transceiver, maxtxpkt and maxrxpkt are not available in ethtool_link_settings. these fields will always be set to zero in the ETHTOOL_GSET reply, and ETHTOOL_SSET will fail if any of them is set to a non-zero value. so likeβ¦ don't. π
users should assume that all fields not marked read-only are writable and subject to validation by the driver. they should use ETHTOOL_GLINKSETTINGS to get the current values before making specific changes, and then apply them with ETHTOOL_SLINKSETTINGS. look before you leap, bestie. π¦
drivers that implement get_link_ksettings and/or set_link_ksettings should ignore the cmd and link_mode_masks_nwords fields (any change to them gets overwritten by the kernel), and rely only on the kernel's internal __ETHTOOL_LINK_MODE_MASK_NBITS and ethtool_link_mode_mask_t. drivers that implement set_link_ksettings should validate all fields other than cmd and link_mode_masks_nwords that are not described as read-only or deprecated, and must ignore all fields described as read-only. periodt. π
link_mode_masks is divided into three bitfields, each of length
π SEE ALSO π
Kernel file ./include/uapi/linux/ethtool.h, 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_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), enum phy_upstream(9)
that's a lot of friends, and honestly? iconic. go read all of them, i'll wait. π
mwah π this page came to you straight from ./include/uapi/linux, dated October 2026, and it signs off right here. stay hydrated, validate your fields, and never write to a read-only member. love u, bye!! πβ¨
π¦ 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