STRUCT PHYLINK_LINK_STATE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 the SPEED_* constants. pick one, bestie, there are options.
  • duplex β€” the link duplex mode, one of the DUPLEX_* constants.
  • pause β€” the link pause state, described by the MLO_PAUSE_* constants.
  • rate_matching β€” the rate matching being performed, one of the RATE_MATCH_* constants. and listen, this one's got lore πŸ“–: if rate matching is taking place, then the speed/duplex of the medium link mode (speed and duplex) 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. 1 bit, huge responsibility πŸ’€
  • an_complete β€” true if autonegotiation has completed. congrats to autoneg on finishing the negotiation πŸŽ‰

⚠️ quick reminder bestie: link and an_complete are unsigned int bitfields 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:

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