phy_attach_direct(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– phy_attach_direct(9) β€” NAME πŸ’–

okay so bestie, welcome to the phy_attach_direct(9) page from the Kernel API Manual ✨ and literally the whole vibe here is: attach a network device to a given PHY device pointer 🫢 that's it, that's the name, no notes, we move.


✨ SYNOPSIS ✨

int phy_attach_direct (struct net_device *dev , struct phy_device
*phydev , u32 flags , phy_interface_t interface );

like, look at her. she's giving very much "one function call, four arguments, main character energy" πŸ‘‘ no cap, copy her exactly πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” the network device you're attaching. she's the one getting hooked up πŸ’–
  • phydev β€” Pointer to the phy_device you wanna attach. literally the pointer to the phy_device, we said what we said 🌸
  • flags β€” the PHY device's dev_flags. flags is flags bestie, they're her flags πŸ¦‹
  • interface β€” the PHY device's interface. that's the interface, mwah ✨

πŸ¦‹ DESCRIPTION πŸ¦‹

so this is the one drivers call when they wanna attach to a particular PHY device β€” like not just any phy, a specific one, iykyk 🌈

the phy_device gets found, periodt, and then it's properly hooked up to the phy_driver πŸ”₯ and here's the cute part: if no driver is attached, then a generic driver is used. she's not gonna leave you hanging, she's got a fallback, she's thoughtful like that 🫢

then the phy_device is given a ptr to the attaching device, and given a callback for link status change β€” so like she can ping you when things update, we love a proactive queen πŸ‘‘

and the phy_device is returned to the attaching driver. oh and also, super important, ngl β€” this function takes a reference on the phy device. so like, don't be weird about it, the ref is there for a reason πŸ’€


πŸ’œ SEE ALSO πŸ’œ

the whole group chat, fr fr β€” Kernel file ./drivers/net/phy/phy_device.c plus:

phy_uses_state_machine(9), phy_register_fixup(9), genphy_match_phy_device(9), get_phy_c45_ids(9), get_phy_c22_id(9), get_phy_device(9), phy_device_register(9), phy_device_remove(9), phy_get_c45_ids(9), phy_find_next(9), phy_prepare_link(9), phy_connect_direct(9), phy_connect(9), phy_disconnect(9), phy_poll_reset(9), phy_sfp_connect_phy(9), phy_sfp_disconnect_phy(9), phy_sfp_attach(9), phy_sfp_detach(9), phy_sfp_probe(9), phy_detach(9), phy_reset_after_clk_enable(9), genphy_config_advert(9), genphy_c37_config_advert(9), genphy_setup_forced(9), genphy_restart_aneg(9), genphy_check_and_restart_aneg(9), __genphy_config_aneg(9), genphy_c37_config_aneg(9), genphy_aneg_done(9), genphy_update_link(9), genphy_read_status_fixed(9), genphy_read_status(9), genphy_c37_read_status(9), genphy_soft_reset(9), genphy_read_abilities(9), phy_remove_link_mode(9), phy_advertise_supported(9), phy_advertise_eee_all(9), phy_support_eee(9), phy_disable_eee(9), phy_support_sym_pause(9), phy_support_asym_pause(9), phy_set_sym_pause(9), phy_set_asym_pause(9), phy_validate_pause(9), phy_get_pause(9), phy_get_internal_delay(9), phy_get_tx_amplitude_gain(9), phy_get_mac_termination(9), phy_get_sfp_port(9), fwnode_mdio_find_device(9), fwnode_phy_find_device(9), fwnode_get_phy_node(9), phy_probe(9), phy_driver_register(9)

like yeah. that's a lot of friends. she's popular. deal with it πŸ’…


🧚 quick vibe check: every one of those references is real and you should go read them, don't just skim the names and pretend bestie, we see you πŸ™ˆ

okay bye, this page lives in ./drivers/net/phy and it's dated October 2026 β€” signed, sealed, delivered, slay πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά

πŸ“¦ where this page comes from