phylink_mii_...decode_state(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay so bestie, welcome to the Kernel API Manual, and today's main character is phylink_mii_c22_pcs_decode_state πŸŽ€ like yes we're doing lowercase-and-underscores-core and it ate.


🌸 NAME 🌸

phylink_mii_c22_pcs_decode_state β€” literally decode the MAC PCS state from MII registers, no cap 🫢


✨ SYNOPSIS ✨

void phylink_mii_c22_pcs_decode_state (struct phylink_link_state *state
, unsigned int neg_mode , u16 bmsr , u16 lpa );

i'm obsessed with this signature actually πŸ’œ


πŸ¦‹ ARGUMENTS πŸ¦‹

  • state β€” a pointer to a struct phylink_link_state. yes queen, hand over the state πŸ’…
  • neg_mode β€” the link negotiation mode, and it's giving PHYLINK_PCS_NEG_xxx energy ✨
  • bmsr β€” The value of the MII_BMSR register. iconic register, no notes 😌
  • lpa β€” The value of the MII_LPA register. also iconic, we love a matching set πŸŽ€

πŸ”₯ DESCRIPTION πŸ”₯

okay so listen up: this is the helper for a MAC PCS that supports the 802.3 clause 22 register set, for clause 37 negotiation and/or SGMII control. very much a two-vibes-at-once situation and we respect it ⭐

what it does is parse the Clause 37 or Cisco SGMII link partner negotiation word into the phylink state structure. like, it takes that word and puts it where it belongs. slay πŸ’–

and here's the tea on when to use it: this is suitable for implementing the pcs_get_state member of the struct phylink_pcs_ops structure β€” but only if accessing bmsr and lpa cannot be done with MDIO directly πŸ‘€. read that again bestie, it's a whole conditional. no MDIO? then this is your girl. 🧚


πŸ‘‘ SEE ALSO πŸ‘‘

the whole friend group, fr fr. the kernel file is ./drivers/net/phy/phylink.c, and then we have:


bestie reminder: that bmsr and lpa bit is load-bearing β€” this helper is the move when MDIO direct access isn't an option, okay? don't come for me if you skip it πŸ™ˆ

kay that's the whole page, mwah πŸ’‹ this was served up from ./drivers/net/phy, dated October 2026, and it's titled phylink_mii_...decode_state(9) β€” and honestly? she's a whole vibe. periodt. πŸ¦‹βœ¨πŸ’–

πŸ“¦ where this page comes from