On Thu, 24 Aug 2000 brad@xxxxxxxxxxx wrote:
> I'm working on a small project that requires that I be able to detect a
> network card's link status (link light) or some equivalent. The project
> involves extending/rewriting Debian's divine project.
You want 'mii-diag'
> I've looked through the devel kernel tree and I was unable to find any
> "hooks" for such a feature. I was under the impression that network cards
> would generate a signal when the interface was down, but perhaps I am
> wrong and each vendor deals with this in their own way if it can be
> reported at all.
For the fully general case, it's not possible to detect link status.
Consider coax -- you can detect a correctly terminated link only by either
receiving or transmitting successfully, but you can't be certain a link
For the very common case of twisted pair media, 10baseT and 100baseTx, there
is usually a link beat indication. But not always e.g. NE2000 clones, which
use the 10baseT link beat signal only to switch from the AUI port.
The most useful case, common and standardized, is MII MDI (Management Data
Interface) registers. They report the link beat along with extensive other
information about the link status.
The downside is that the usual interface to the MII registers is a serial
bit stream. Reading a register can take 50usec of locked CPU time to
generate. So the drivers minimize the implicit MII register reads, instead
require explicit MII reads. I stress this because there have been repeated
proposals to show the MII registers in /proc/net/* or /proc/bus/mii/eth0.
There are multiple problems with this, but 2*32*50usec. of CPU time is the
clearest argument against it.
Donald Becker becker@xxxxxxxxx
Scyld Computing Corporation http://www.scyld.com
410 Severn Ave. Suite 210 Beowulf-II Cluster Distribution
Annapolis MD 21403