pcs_get_state(9)
π pcs_get_state(9) β the Kernel API Manual, but make it make sense π
okay so bestie, we're deep in phylink territory today and this one is literally the vibe check for your MAC PCS π
it's the call that goes "hey hardware, what's your deal right now?" and reports back. no cap, it's giving main character energy in the inband link state department.
β¨ NAME β¨
pcs_get_state β read the current inband link state straight from the hardware π«Ά
π¦ SYNOPSIS π¦
void pcs_get_state (struct phylink_pcs *pcs , unsigned int neg_mode ,
struct phylink_link_state *state );
three args, one void return, zero drama. slay.
π ARGUMENTS π
pcsβ a pointer to astruct phylink_pcs. yes, the PCS itself. the whole point πͺneg_modeβ the link negotiation mode, and it's one of thePHYLINK_PCS_NEG_xxxvalues. remember that, it comes back later πstateβ a pointer to astruct phylink_link_state. this is the lil report card you're filling in π
πΈ DESCRIPTION πΈ
So what does it actually do? It reads the current inband link state from the MAC PCS and fills in your state struct like the world's most responsible bestie π specifically:
- current speed goes in
state->speed - duplex mode goes in
state->duplex - pause mode goes in
state->pause, using theMLO_PAUSE_RXandMLO_PAUSE_TXbits - negotiation completion state goes in
state->an_complete - link up state goes in
state->link
and if it's possible? you should also populate state->lp_advertising. like, if you can. it's the polite thing to do β¨
β οΈ okay important heads up bestie: theneg_modeparameter is always thePHYLINK_PCS_NEG_xxxstate, notMLO_AN_xxx. do not mix those up, i'm literally begging π it's a whole different enum, iykyk.
π₯ SEE ALSO π₯
- Kernel file
./include/linux/phylink.h struct phylink_link_state(9)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_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)
like, that's the whole friend group right there π go read them, they all ate π
aaaand that's the page!! this one lives under ./include/linux, dated October 2026, and it's pcs_get_state(9) β go forth and read your link state, queen π§π
π¦ 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