STRUCT ETHTOOL_PHY_OPS(9)
π NAME π
struct ethtool_phy_ops β the optional PHY device options, bestie. That's it, that's the whole vibe. It's a little bundle of function pointers you can fill in for your PHY, and literally none of them are required (more on that in a sec, it's giving "no pressure" π
).
This is straight out of the Kernel API Manual, and we're gonna go through the whole thing together, no skipping, no cap β¨
β¨ SYNOPSIS β¨
Okay so here's the struct in all its glory, copied exactly, don't @ me about the line breaks:
struct ethtool_phy_ops {
int (*get_sset_count)(struct phy_device *dev);
int (*get_strings)(struct phy_device *dev, u8 *data);
int (*get_stats)(struct phy_device *dev, struct ethtool_stats
*stats, u64 *data);
int (*get_plca_cfg)(struct phy_device *dev, struct phy_plca_cfg
*plca_cfg);
int (*set_plca_cfg)(struct phy_device *dev, const struct
phy_plca_cfg *plca_cfg, struct netlink_ext_ack *extack);
int (*get_plca_status)(struct phy_device *dev, struct
phy_plca_status *plca_st);
int (*start_cable_test)(struct phy_device *phydev, struct
netlink_ext_ack *extack);
int (*start_cable_test_tdr)(struct phy_device *phydev, struct
netlink_ext_ack *extack, const struct phy_tdr_config *config);
};
Look at all those function pointers π¦ β every single one of them is a little optional superpower you can bolt onto your PHY. Slay.
π Members π
Let's do a lil roll call, one by one, so you know exactly who's who in this friend group π«Ά
get_sset_countβ tells you how many stringsget_stringsis gonna write. Basically the "how many are we expecting" headcount before the party πget_stringsβ hands back a set of strings that describe the objects you asked for. The actual name tags, if you will π·οΈget_statsβ returns extended statistics about the PHY device. All the numbers, all the receipts πget_plca_cfgβ returns the PLCA configuration. Reading the settings, lowkey iconic.set_plca_cfgβ sets the PLCA configuration. Now you're writing the settings, main character energy π₯get_plca_statusβ gets the PLCA configuration. Yep, the doc says "Get PLCA configuration" for this one too β I'm just passing along what it says, fr fr πstart_cable_testβ starts a cable test. Go little cable, go π§start_cable_test_tdrβ starts a Time Domain Reflectometry cable test. The fancy one. The deluxe edition β
πΈ Description πΈ
Okay here's the part you actually need to remember, bestie, so let me be loud about it:
All operations are optional (i.e. the function pointer may be set to NULL) and callers must take this into account. So like, don't just assume every pointer's been filled in β vibe check your struct first π
Also: callers must hold the RTNL lock. That's not a suggestion, that's the rule. Lock first, then call. Periodt π
π¦ SEE ALSO π¦
The kernel file lives at ./include/linux/ethtool.h, and honestly the whole extended fam is worth a look π:
enum ethtool_phys_id_state(9)struct kernel_ethtool_ringparam(9)enum ethtool_supported_ring_param(9)ethtool_rxfh_indir_default(9)struct ethtool_rxfh_context(9)ethtool_link_ksettings_zero_link_mode(9)ethtool_link_ksettings_add_link_mode(9)ethtool_link_ksettings_del_link_mode(9)ethtool_link_ksettings_test_link_mode(9)ethtool_intersect_link_masks(9)struct ethtool_phy_stats(9)struct ethtool_pause_stats(9)struct ethtool_fec_hist_range(9)struct ethtool_fec_stats(9)struct ethtool_rmon_hist_range(9)struct ethtool_rmon_stats(9)struct ethtool_ts_stats(9)struct ethtool_module_eeprom(9)struct ethtool_module_power_mode_params(9)struct ethtool_mm_state(9)struct ethtool_mm_cfg(9)struct ethtool_mm_stats(9)struct ethtool_mmsv_ops(9)struct ethtool_mmsv(9)struct ethtool_rxfh_param(9)struct ethtool_rxfh_fields(9)struct kernel_ethtool_ts_info(9)struct ethtool_ops(9)struct ethtool_netdev_state(9)ethtool_set_ethtool_phy_ops(9)ethtool_params_from_link_mode(9)ethtool_get_phc_vclocks(9)ethtool_mm_frag_size_add_to_min(9)ethtool_mm_frag_size_min_to_add(9)ethtool_get_ts_info_by_layer(9)ethtool_sprintf(9)ethtool_puts(9)ethtool_cpy(9)
π Friendly reminder before you bounce: set your unset pointers toNULL, check forNULLbefore you call, and hold the RTNL lock. That's the whole assignment, you've got this π«Ά
And that's the page, bestie! It came from ./include/linux, it's dated October 2026, and the whole thing is filed under struct ethtool_phy_ops(9). Go be iconic with your PHY ops π
β¨π
π¦ 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