David Young
2012-11-13 23:56:03 UTC
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
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
***@pobox.com Urbana, IL (217) 721-9981
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
David Young
***@pobox.com Urbana, IL (217) 721-9981
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de