STRUCT ETHTOOL_LINK_SETTINGS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

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 literally ETHTOOL_GLINKSETTINGS or ETHTOOL_SLINKSETTINGS. pick one, she's not flexible. 😌
  • speed β€” link speed, in Mbps.
  • duplex β€” duplex mode; one of the DUPLEX_* values.
  • port β€” physical connector type; one of the PORT_* values.
  • phy_address β€” MDIO address of the PHY (aka the transceiver); 0 or 255 if it's not applicable. for clause 45 PHYs this is the PRTAD. iykyk. πŸ’…
  • autoneg β€” turns autonegotiation and auto-detection on/off; either AUTONEG_DISABLE or AUTONEG_ENABLE.
  • mdio_support β€” bitmask of ETH_MDIO_SUPPORTS_* flags for the MDIO protocols this interface supports; 0 if unknown. read-only, so don't even try it. πŸ™ˆ
  • eth_tp_mdix β€” Ethernet twisted-pair MDI(-X) status; one of the ETH_TP_MDI_* values. if the status is unknown or not applicable, the value will be ETH_TP_MDI_INVALID. also read-only. πŸ‘‘
  • eth_tp_mdix_ctrl β€” Ethernet twisted pair MDI(-X) control; one of the ETH_TP_MDI_* values. if MDI(-X) control isn't implemented, reads yield ETH_TP_MDI_INVALID and 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; 0 if unknown or not applicable. read-only.
  • 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 try ETHTOOL_GLINKSETTINGS, and if it succeeds use ETHTOOL_SLINKSETTINGS to change link settings β€” do not use ETHTOOL_SSET if ETHTOOL_GLINKSETTINGS succeeded: stick to ETHTOOL_GLINKSETTINGS/SLINKSETTINGS in that case. conversely, if ETHTOOL_GLINKSETTINGS fails, use ETHTOOL_GSET to query and ETHTOOL_SSET to change link settings β€” do not use ETHTOOL_SLINKSETTINGS if ETHTOOL_GLINKSETTINGS failed: stick to ETHTOOL_GSET/ETHTOOL_SSET in 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