Subject: Ethernet, MII & PHY, round two
To: None <tech-net@netbsd.org>
From: Erik E. Fair <fair@clock.org>
List: tech-net
Date: 10/26/2002 09:55:40
I've been in correspondence with a NetBSD user of -current whose
setup stopped working when I committed the change to the Ethernet
drivers so that PHYs other than instance zero could be selected. His
set up probes as follows:
fxp0 at pci0 dev 15 function 0: Intel i82557 Ethernet, rev 2
fxp0: interrupting at apic 2 int 19 (irq 11)
fxp0: Ethernet address 00:a0:c9:6e:b7:0f
icsphy0 at fxp0 phy 1: ICS1890 10/100 media interface, rev. 3
icsphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
ukphy0 at fxp0 phy 2: Generic IEEE 802.3u media interface
ukphy0: OUI 0xc0b703, model 0x0008, rev. 3
ukphy0: 10baseT, 100baseTX, 100baseTX-FDX, auto
Note, as previously mentioned: no instance numbers are reported by
the autoconfig output - just PHY numbers. In this case, PHY 1 is
instance zero, and PHY 2 is instance one.
The change that I made to the drivers changed which PHY was selected
by default by the kernel because all it asks for is "whichever PHY
can do auto select" and in this case, both of them have that
attribute, so the last one found was selected. It's my guess that
only the first of them is actually wired up to an RJ-45 (the ICS
PHY); end result: Ethernet doesn't work any more, because the wrong
PHY was selected by the kernel, and the user didn't override with
ifconfig(8).
I suggested adding "instance 0" after the "media" statement in his
"ifconfig" line in /etc/rc.conf (or /etc/ifconfig.fxp0), but there
is another fix we could make: allow twisted-pair PHYs to refuse to
be selected when "link" is not present; I believe if I'm reading
the code right that there is a testable bit for it. I haven't checked
to see if the media change code is allowed to return errors, though.
comments?
Erik <fair@clock.org>