mac_prepare(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… mac_prepare(9) β€” from the Kernel API Manual, bestie πŸŽ€

okay so picture this: it's mac_prepare(9), it lives in the Kernel API Manual, and it is literally the "get ready bestie, we're about to switch things up" function. no cap.


✨ NAME ✨

mac_prepare β€” prepare to change the PHY interface mode πŸ¦‹


🌸 SYNOPSIS 🌸

int mac_prepare (struct phylink_config *config , unsigned int mode ,
       phy_interface_t iface );

🫢 ARGUMENTS 🫢

  • config β€” a pointer to a struct phylink_config. yes, that struct. πŸ’–
  • mode β€” one of MLO_AN_FIXED, MLO_AN_PHY, MLO_AN_INBAND. pick your fighter πŸ‘‘
  • iface β€” the interface mode to switch to. the glow-up destination ✨

πŸ’… DESCRIPTION πŸ’…

so here's the tea: phylink will call this method at the beginning of a full initialisation of the link β€” that's the whole reset-and-redo moment, and it includes changing the interface mode, or it can happen at initial startup time. it may even be called for the current mode, like, no change at all, just vibes. πŸ™ˆ

the MAC driver should perform whatever actions are required at that point β€” for example, disabling the Serdes PHY. do what you gotta do, babe. 🧚

this is gonna be the first call in the sequence, and the sequence slays in this exact order:

  1. mac_prepare
  2. mac_config
  3. pcs_config
  4. possible pcs_an_restart
  5. mac_finish

and the return situation: it returns zero on success, or a negative errno on failure β€” and ngl, if you fail, that errno gets reported to the kernel log. so everyone will know. 😭 no pressure tho πŸ”₯


🌈 SEE ALSO 🌈

Kernel file ./include/linux/phylink.h, plus the whole friend group: struct phylink_link_state(9), struct phylink_config(9), struct phylink_mac_ops(9), mac_get_caps(9), mac_select_pcs(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 page, bestie β€” sourced from ./include/linux, dated October 2026, filed under mac_prepare(9). mwah πŸ’‹ πŸŽ€

πŸ“¦ where this page comes from