tech-net archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
half-/full-duplex ethernet and ifconfig
Today I noticed a funny thing about the ethernet media settings that I
can see and choose through 'ifconfig wm0':
supported Ethernet media:
media none
media 10baseT
media 10baseT mediaopt full-duplex
media 100baseTX
media 100baseTX mediaopt full-duplex
media 1000baseT
media 1000baseT mediaopt full-duplex
media autoselect
What's the difference between 'media 10baseT' and 'media 10baseT
mediaopt full-duplex' ?
I thought at first that if I did 'ifconfig wm0 media 10baseT' then it
was up to my NIC and its link partner to negotiate the duplex setting.
I.e., that if I don't specify a duplex setting, then the system assumes
that I don't care. I also expected that whichever duplex setting was
negotiated, I could read it out again using 'ifconfig wm0'. So if I set
'ifconfig wm0 media 10baseT', I should see either
media: Ethernet 10baseT (10baseT full-duplex)
status: active
or
media: Ethernet 10baseT (10baseT half-duplex)
status: active
since the kernel defines non-zero flags for both (IFM_HDX, IFM_FDX).
Instead, I see this:
media: Ethernet 10baseT
status: active
Grovelling a bit in the ifconfig(8) code, I see that that
parentheses-less output means the "active" (negotiated) media and the
"current" (selected) media setting are the same: they're both Ethernet
10baseT.
Digging deeper, I find these lines in mii_phy_add_media():
if (sc->mii_capabilities & BMSR_10THDX) {
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, sc->mii_inst),
MII_MEDIA_10_T);
PRINT("10baseT");
}
if (sc->mii_capabilities & BMSR_10TFDX) {
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_FDX, sc->mii_inst),
MII_MEDIA_10_T_FDX);
PRINT("10baseT-FDX");
fdx = 1;
}
This tells me that we're using 0, not IFM_HDX, to represent
"half-duplex"---or do I have the wrong interpretation---and there is no
way to select a rate setting independent of a duplex setting.
But hold on a minute, I see some PHY drivers are using both IFM_HDX
IFM_FDX at least to tell what the negotiated media is:
% grep IFM_HDX ../../dev/mii/*
../../dev/mii/atphy.c: mii->mii_media_active |= IFM_HDX;
../../dev/mii/bmtphy.c: mii->mii_media_active |= IFM_HDX;
../../dev/mii/brgphy.c: mii->mii_media_active |=
IFM_HDX;
../../dev/mii/etphy.c: mii->mii_media_active |= IFM_HDX;
../../dev/mii/rdcphy.c: mii->mii_media_active |= IFM_HDX;
../../dev/mii/rgephy.c: mii->mii_media_active |= IFM_HDX;
../../dev/mii/rgephy.c: mii->mii_media_active |= IFM_HDX;
I am having a hard time seeing the design intention here, can someone
help me out?
Dave
--
David Young
dyoung%pobox.com@localhost Urbana, IL (217) 721-9981
Home |
Main Index |
Thread Index |
Old Index