STRUCT ETHTOOL_FECPARAM(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct ethtool_fecparam(9) β€” Kernel API Manual πŸŽ€

okay bestie, so this is a page from the Kernel API Manual and it's literally all about struct ethtool_fecparam β€” that's the Ethernet Forward Error Correction parameters struct. FEC is the glow-up your link does so bits don't get corrupted, and this struct is how userspace talks to the kernel about it. no cap, it's iconic. ✨


🌸 NAME 🌸

struct ethtool_fecparam β€” Ethernet Forward Error Correction parameters. that's it, that's the vibe. πŸ¦‹


✨ SYNOPSIS ✨

struct ethtool_fecparam {
    __u32 cmd;
    __u32 active_fec;
    __u32 fec;
    __u32 reserved;
 };

look at her. four little __u32 fields, all in a row. main character energy fr fr. πŸ’œ


🫢 Members 🫢

okay so let's meet the cast:

  • cmd β€” the command number, and it's either ETHTOOL_GFECPARAM or ETHTOOL_SFECPARAM. G for get, S for set, iykyk. πŸ’…
  • active_fec β€” the FEC mode that's actually active on the port rn. it's a single bit set, and it's GET only β€” you don't write this one, bestie, you just read it. πŸ‘€
  • fec β€” a bitmask of the configured FEC modes. this is the one you actually play with. πŸŽ€
  • reserved β€” reserved for future extensions. on GET you ignore it, on SET you write 0. don't be weird about it. πŸ™ˆ

πŸ’– Description πŸ’–

okay so storytime, because reserved has lore. 😭 it was never validated on input, and ethtool user space left it uninitialized when calling SET. so going forward, it can only be used to return a value to userspace with GET. that's the whole deal. periodt.

the FEC modes your device supports can be read via ETHTOOL_GLINKSETTINGS. and here's the thing β€” FEC settings get configured by link autonegotiation whenever autoneg is enabled. with autoneg on, ETHTOOL_GFECPARAM is what you use to read the current mode. slay. ✨

when autoneg is disabled, then ETHTOOL_SFECPARAM controls the FEC settings. and the recommendation to drivers is very much: only accept a single bit set in fec. because when multiple bits are set in fec, drivers may pick the mode in an implementation dependent way β€” which is giving chaos, ngl. πŸ’€

drivers should reject mixing ETHTOOL_FEC_AUTO_BIT with other FEC modes, because it's unclear whether in that case the other modes constrain AUTO or are independent choices. the ambiguity is not cute. 🫠

and the hard rule: drivers must reject SET requests if they support none of the requested modes. no silent ignoring, bestie. 🚫

if the device doesn't support FEC, drivers may use ETHTOOL_FEC_NONE instead of returning EOPNOTSUPP from ETHTOOL_GFECPARAM. lowkey a nicer way to handle it. 🧚

oh and for the definition of valid bits for both fec and active_fec, go see enum ethtool_fec_config_bits. that's the source of truth, bestie. πŸ‘‘

ngl the reserved-field thing is a whole cautionary tale β€” it was never validated on input and ethtool user space left it uninitialized on SET, so going forward it can only be used to return a value to userspace with GET. read that twice. πŸ’…

🌈 SEE ALSO 🌈

the whole friend group, in order, no one left out:

  • 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)
  • enum ethtool_fec_config_bits(9)
  • struct ethtool_link_settings(9)
  • enum phy_upstream(9)

that's the whole page bestie, you ate it. πŸ“

sign-off time: this one lives in ./include/uapi/linux, dated October 2026, and it's page struct ethtool_fecparam(9) of the Kernel API Manual. go forth and configure your FEC correctly, ily πŸ’–βœ¨πŸ‘‘

πŸ“¦ where this page comes from