STRUCT ETHTOOL_GSTRINGS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– struct ethtool_gstrings(9) πŸ’–

okay so this is a page from the Kernel API Manual β€” yes, the kernel has a manual, and yes it's kinda iconic. buckle up bestie, we're talking about the little struct that holds your string sets for data tagging πŸŽ€


✨ NAME ✨

struct ethtool_gstrings β€” the string set for data tagging. that's it, that's the vibe πŸ¦‹


✨ SYNOPSIS ✨

struct ethtool_gstrings {
    __u32 cmd;
    __u32 string_set;
    __u32 len;
    __u8 data[];
 };

look at her. four fields and a dream 🌸


✨ Members ✨

  • cmd β€” the command number, and it is literally ETHTOOL_GSTRINGS. no notes, it just is πŸ’…
  • string_set β€” the string set ID. it's one of enum ethtool_stringset, so pick from the menu, don't freestyle πŸ™ˆ
  • len β€” how many strings live in the string set. the headcount, basically πŸ‘‘
  • data β€” the buffer where the strings actually go. each string is null-padded out to a size of ETH_GSTRING_LEN. so they all line up cute and even πŸ’–

✨ Description ✨

okay so the important part: users must use ETHTOOL_GSSET_INFO to find out how many strings are in the string set. like, don't guess. don't count on your fingers. ask. πŸ”₯

then they must allocate a buffer of the appropriate size immediately following this structure. immediately after, bestie. the data field is a flexible array thing so it lives right there at the end 🧚

setting len on input is optional (though preferred β€” glow up and set it πŸ’…), but if you're not setting it, it must be zeroed. otherwise. zeroed. got it? 😭

when it is set, len will return the requested count if it matches the actual count; otherwise, it will be zero. and the reason is genuinely so valid β€” this prevents issues when the number of strings is different than the userspace allocation. mismatch protection, we love to see it 🫢

ngl this is one of those "small detail, huge consequences" situations. zero your len if you're not setting it. no cap. πŸ’€

✨ SEE ALSO ✨

the kernel file ./include/uapi/linux/ethtool.h, plus this absolutely enormous friend group of related pages β€” she knows everyone 🌈

  • 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_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)

like I said. she knows everyone. iykyk πŸ’œ


and that's the page!! mwah πŸ’‹ this little beauty lives in the source tree at ./include/uapi/linux, and the version/date stamp on her is October 2026 β€” so yeah, she's from the future, main character energy only β­πŸ‘‘ hope that helped bestie, go forth and allocate your buffers correctly πŸ¦‹πŸ’–

πŸ“¦ where this page comes from