phy_caps_lookup(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… phy_caps_lookup β€” the kernel API manual, bestie edition ✨

okay so this is phy_caps_lookup(9) from the Kernel API Manual, and honestly? it's giving "matchmaker for network link speeds" πŸŽ€


✨ NAME ✨

phy_caps_lookup β€” lookup capabilities by speed/duplex that matches a mask 🫢


🌸 SYNOPSIS 🌸

const struct link_capabilities * phy_caps_lookup (int speed , unsigned
int duplex , const unsigned long *supported , bool exact );

bestie it literally returns a pointer, no cap πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • speed β€” the speed you wanna match, that's the vibe check right there ⭐
  • duplex β€” the duplex you wanna match, periodt
  • supported β€” a mask of linkmodes to match against πŸ”₯
  • exact β€” do you want an exact match or not, like yes or no ma'am πŸ™ˆ

πŸ‘‘ DESCRIPTION πŸ‘‘

So the whole point: it looks up a link_capabilities entry that intersects the supported linkmodes mask, and that matches the speed and duplex you passed in. iconic behavior honestly πŸ’–

When exact is set, an exact match is performed on speed and duplex β€” meaning that if the linkmodes for the given speed and duplex intersect the supported mask, this capability is returned. otherwise we don't have a match and we return NULL. 😭 that's it, that's the deal, no wiggle room.

When exact is not set, we return either an exact match, or matching capabilities at lower speed, or the lowest matching speed, or NULL. so like, a whole little ladder of possibilities, she's flexible πŸ’«

Non-exact matches will try to return an exact speed and duplex match, but may return matching capabilities with same speed but a different duplex. lowkey chaotic but it's fine, that's the documented behavior 🫢


πŸ”₯ RETURN πŸ”₯

a matched link_capabilities according to the above process, NULL otherwise. slay 🌈


🌟 SEE ALSO 🌟

Kernel file ./drivers/net/phy/phy_caps.c plus the whole friend group: phy_caps_init(9), phy_caps_speeds(9), phy_caps_lookup_by_linkmode(9), phy_caps_lookup_by_linkmode_rev(9), phy_caps_linkmode_max_speed(9), phy_caps_valid(9), phy_caps_linkmodes(9), phy_caps_from_interface(9), phy_caps_medium_get_supported(9), phy_caps_mediums_from_linkmodes(9) β€” go read them, iykyk πŸ’œ


okay bye bestie, this page lived at ./drivers/net/phy in October 2026, and that's the whole footer, love u, mwah πŸ§šπŸ’–

πŸ“¦ where this page comes from