mii_nway_result(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

โœจ mii_nway_result(9) โœจ

okay so this is a page from the Kernel API Manual and honestly? it's a little icon of a function ๐Ÿ’… it takes a bunch of MII abilities and tells you which media type you actually get. let's get into it ๐Ÿซถ


๐ŸŒธ NAME ๐ŸŒธ

mii_nway_result โ€”

and yes bestie, the one-liner is genuinely blank upstream ๐Ÿ˜ญ the manpage just... doesn't finish the sentence. not me leaving it exactly as I found it, no cap. the description below is where the tea is โ˜•


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

unsigned int mii_nway_result (unsigned int negotiated );

๐Ÿฆ‹ ARGUMENTS ๐Ÿฆ‹

  • negotiated โ€” this is the value of MII ANAR and'd with ANLPAR. like, the two auto-negotiation registers smooshed together with a bitwise AND. that's the whole input, periodt ๐Ÿ”ฅ

๐Ÿ’– DESCRIPTION ๐Ÿ’–

so here's the vibe: you hand it a set of MII abilities, it checks each bit, and it returns the currently supported media โ€” in the priority order defined by IEEE 802.3u. iconic. โญ

it uses LPA_xxx constants, but heads up bestie ๐Ÿซถ this is not the value of LPA solely โ€” as described above (ANAR AND'd with ANLPAR), remember?

there's exactly one exception to IEEE 802.3u, and it's lowkey important ngl: 100baseT4 is placed between 100T-full and 100T-half. if your phy doesn't support 100T4, that's totally fine, no drama ๐Ÿ’… but if your phy places 100T4 elsewhere in the priority order, then the built-in one won't match your phy and you will need to roll your own function. not me telling you to write your own ๐Ÿ˜ญ but like, fr fr, you gotta.

๐Ÿšจ tl;dr on the caveat: the ordering is hardcoded to IEEE 802.3u + that one 100T4 tweak. if your hardware disagrees with that ordering, this function isn't it for you.

๐Ÿ”ฎ SEE ALSO ๐Ÿ”ฎ

oh you want the whole friend group? say less ๐Ÿ‘‘


and that's the whole page bestie! ๐Ÿงš this one's from ./include/linux, dated October 2026 โ€” mwah, go forth and negotiate your link at the highest priority available ๐Ÿ’œ๐ŸŒˆ

#mii_nway_result #iykyk #slay

๐Ÿ“ฆ where this page comes from