ksz_phy_addr_to_port(9)
β¨ ksz_phy_addr_to_port β the PHY-address-to-port glow-up β¨
okay bestie, so this is a Kernel API Manual page for ksz_phy_addr_to_port(9) and honestly it's giving "small function, big main character energy" π
let's get into it.
πΈ NAME πΈ
ksz_phy_addr_to_port β literally maps a PHY address to the corresponding switch port. that's it, that's the vibe π
π¦ SYNOPSIS π¦
int ksz_phy_addr_to_port (struct ksz_device *dev , int addr );
no cap, that's the whole signature β¨
π ARGUMENTS π
devβ pointer to the device structure. you know, the device. the one doing the device-ing π«Άaddrβ the PHY address you want to map to a port.
π DESCRIPTION π
so here's the tea β β this function finds the corresponding switch port for a given PHY address by iterating over all user ports on the device. yes, all of them. it's doing the rounds, it's being thorough π
for each port it checks two things:
- does that port's PHY address in
phy_addr_mapmatch the specified address? π - does the port contain an internal PHY?
and if a match is found, the index of the port gets returned. slay β¨
π₯ RETURN π₯
- Port index on success π
-EINVALif no matching port is found π (iykyk, it happens)
π SEE ALSO π
the kernel file lives right here: ./drivers/net/dsa/microchip/ksz_common.c π
and here's the whole friend group, all iconic, all in the same directory-era:
ksz_phylink_mac_disable_tx_lpi(9)ksz_phylink_mac_enable_tx_lpi(9)ksz_update_port_member(9)ksz_parent_mdio_read(9)ksz_parent_mdio_write(9)ksz_irq_phy_setup(9)ksz_irq_phy_free(9)ksz_parse_dt_phy_config(9)ksz_mdio_register(9)ksz_handle_wake_reason(9)ksz_is_port_mac_global_usable(9)ksz_get_wol(9)ksz_set_wol(9)ksz_wol_pre_shutdown(9)ksz_switch_macaddr_get(9)ksz_switch_shutdown(9)ksz_drive_strength_to_reg(9)ksz_drive_strength_error(9)ksz_drive_strength_write(9)
π tiny reminder bestie: if nothing matches, you're getting -EINVAL back, not a port index. don't @ me, that's just what the return value says.
and that's the whole page π§π this one's from ./drivers/net/dsa/microchip, dated October 2026, and it's called ksz_phy_addr_to_port(9) β periodt. πβ¨
π¦ 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