STRUCT PHYLINK_LINK_STATE(9)
π NAME π
struct phylink_link_state β bestie, this is the link state structure. it holds literally everything you need to know about what a link is doing rn. iconic behavior honestly.
β¨ SYNOPSIS β¨
okay so here's the whole struct, laid out exactly as it lives, no cap:
struct phylink_link_state {
unsigned long advertising[BITS_TO_LONGS(
__ETHTOOL_LINK_MODE_MASK_NBITS)];
unsigned long lp_advertising[BITS_TO_LONGS(
__ETHTOOL_LINK_MODE_MASK_NBITS)];
phy_interface_t interface;
int speed;
int duplex;
int pause;
int rate_matching;
unsigned int link:1;
unsigned int an_complete:1;
};
like, look at her. two big bitmasks, a bunch of ints, and two lil one-bit flags at the end. main character energy tbh π«Ά
π Members π
these are the fields, one by one, so you don't have to guess π
advertisingβ an ethtool bitmask holding the advertised link modes. basically the "here's what i bring to the table" list πlp_advertisingβ another ethtool bitmask, but this one's holding the link partner advertised link modes. your partner's vibe check, if you will π¦interfaceβ the link typedef phy_interface_t mode. yes it's a typedef, yes it's fancy.speedβ the link speed, and it's one of theSPEED_*constants. pick one, bestie, there are options.duplexβ the link duplex mode, one of theDUPLEX_*constants.pauseβ the link pause state, described by theMLO_PAUSE_*constants.rate_matchingβ the rate matching being performed, one of theRATE_MATCH_*constants. and listen, this one's got lore π: if rate matching is taking place, then the speed/duplex of the medium link mode (speedandduplex) and the speed/duplex of the phy interface mode (interface) are different. like they do NOT match. that's the whole point. periodt.linkβ true if the link is up. that's it.1bit, huge responsibility πan_completeβ true if autonegotiation has completed. congrats to autoneg on finishing the negotiation π
β οΈ quick reminder bestie:linkandan_completeareunsigned intbitfields of width 1. don't be out here cramming a whole mood into one bit, that's just how it is.
π SEE ALSO π
living in the kernel file ./include/linux/phylink.h β go read it, iykyk β alongside this whole friend group:
struct phylink_config(9)struct phylink_mac_ops(9)mac_get_caps(9)mac_select_pcs(9)mac_prepare(9)mac_config(9)mac_finish(9)mac_link_down(9)mac_link_up(9)mac_disable_tx_lpi(9)mac_enable_tx_lpi(9)mac_wol_set(9)struct phylink_pcs(9)struct phylink_pcs_ops(9)pcs_validate(9)pcs_inband_caps(9)pcs_enable(9)pcs_disable(9)pcs_get_state(9)pcs_config(9)pcs_an_restart(9)pcs_link_up(9)pcs_disable_eee(9)pcs_enable_eee(9)pcs_pre_init(9)phylink_get_link_timer_ns(9)phylink_mac_implements_lpi(9)
that's the whole squad, literally every one of them π
πΈ ok that's the page, bestie!! sourced from ./include/linux, dated October 2026 β go slay your link states, mwah πβ¨
π¦ 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