Question

I'm looking for the best way to interpret the standard (well, standardish) Ethernet PHY registers, to determine the speed that an Ethernet link is actually running at. (e.g. 10/100/1000 and full/half-duplex)

I daresay that this is to be found in the source of things like Linux, and I'm just off to look there now, but if anyone has a good reference I'd be interested.

What I'm interested in is if it actually linked and what it linked at, rather than the vast sea of possibilities that each end has advertised at the outset.

Was it helpful?

Solution

Thanks for the answer. It's intended as a language and platform agnostic question, because pretty much all MII/GMII Ethernet PHYs have the same basic registers. I happen to be on an embedded platform.

But I found a sensible sequence which was good enough for my restricted application by looking at various bits of Linux driver source - it's basically:

Check for link-up in basic-status (0x1) If the link's up then check for negotiation-complete in basic status (0x1) If the negotiation's complete then check for 1G in the 1000M-status register (0xa) If you've not got 1G, then you've got 100M. (That's not a general rule, but it applies in this application)

Maybe this was really a hardware question rather than a software one...

OTHER TIPS

To help you looking at how the Linux kernel does it: While each driver can do its own thing, there is a generic version which is supposed to be used when the chip follows the standard closely enough: Generic Media Independent Interface device support.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top