[eepro100] automatic detection of media
Donald Becker
becker@scyld.com
Sun Jan 27 15:25:02 2002
On Sun, 27 Jan 2002, Deepak Chawla wrote:
> I'm using eepro100.o for my ethernet card (on Toshiba 2805 S202).
> While trying to initialize eth0 on bootup, it takes quite a while before the
> driver gives up on initialization if it is not connected to the LAN.
Presumably DHCP...
> I'm currently handling this by forcing the rc.sysinit to confirm
> initialization of eth0 during bootup, and then pressing Y/N as the case may
> be.
You can use the exit status from mii-diag:
mii-diag --status eth0
Look for exit status '2', which means no link beat.
> I was wondering if there is a more elegant way of doing this, like
> decreasing the timeout, or better still a way for automatic detection of
> media so that as soon as the computer is "wired", it brings up the
> interface, and brings it down again when the media is no longer present.
There is no elegant way. You will have to poll the interface with
'mii-diag'. You might think that this is wasteful, but the system would
end up polling anyway, and by transferring the polling policy to the
user code we don't pretend that the operation is free.
Note that there will always be a race between briefly seeing link beat
and sending out the DHCP request.
You'll want to change the DHCP timeout to a much shorter value. If you
don't get a response in two seconds, you won't be getting one.
Donald Becker becker@scyld.com
Scyld Computing Corporation http://www.scyld.com
410 Severn Ave. Suite 210 Second Generation Beowulf Clusters
Annapolis MD 21403 410-990-9993