diff --git a/sys/dev/e1000/e1000_phy.c b/sys/dev/e1000/e1000_phy.c --- a/sys/dev/e1000/e1000_phy.c +++ b/sys/dev/e1000/e1000_phy.c @@ -1707,9 +1707,10 @@ * autonegotiation. */ ret_val = e1000_copper_link_autoneg(hw); - if (ret_val) + if (ret_val && !hw->mac.forced_speed_duplex) return ret_val; - } else { + } + if (!hw->mac.autoneg || (ret_val && hw->mac.forced_speed_duplex)) { /* PHY will be set to 10H, 10F, 100H or 100F * depending on user settings. */ diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -1816,7 +1816,18 @@ (sc->hw.phy.media_type == e1000_media_type_internal_serdes)) { if (sc->hw.mac.type == e1000_82545) fiber_type = IFM_1000_LX; - ifmr->ifm_active |= fiber_type | IFM_FDX; + switch (sc->link_speed) { + case 10: + ifmr->ifm_active |= IFM_10_FL; + break; + case 100: + ifmr->ifm_active |= IFM_100_FX; + break; + case 1000: + default: + ifmr->ifm_active |= fiber_type | IFM_FDX; + break; + } } else { switch (sc->link_speed) { case 10: @@ -1829,11 +1840,12 @@ ifmr->ifm_active |= IFM_1000_T; break; } - if (sc->link_duplex == FULL_DUPLEX) - ifmr->ifm_active |= IFM_FDX; - else - ifmr->ifm_active |= IFM_HDX; } + + if (sc->link_duplex == FULL_DUPLEX) + ifmr->ifm_active |= IFM_FDX; + else + ifmr->ifm_active |= IFM_HDX; } /********************************************************************* @@ -1867,6 +1879,26 @@ sc->hw.phy.autoneg_advertised = ADVERTISE_1000_FULL; break; case IFM_100_TX: + sc->hw.mac.autoneg = DO_AUTO_NEG; + if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) { + sc->hw.phy.autoneg_advertised = ADVERTISE_100_FULL; + sc->hw.mac.forced_speed_duplex = ADVERTISE_100_FULL; + } else { + sc->hw.phy.autoneg_advertised = ADVERTISE_100_HALF; + sc->hw.mac.forced_speed_duplex = ADVERTISE_100_HALF; + } + break; + case IFM_10_T: + sc->hw.mac.autoneg = DO_AUTO_NEG; + if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) { + sc->hw.phy.autoneg_advertised = ADVERTISE_10_FULL; + sc->hw.mac.forced_speed_duplex = ADVERTISE_10_FULL; + } else { + sc->hw.phy.autoneg_advertised = ADVERTISE_10_HALF; + sc->hw.mac.forced_speed_duplex = ADVERTISE_10_HALF; + } + break; + case IFM_100_FX: sc->hw.mac.autoneg = false; sc->hw.phy.autoneg_advertised = 0; if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) @@ -1874,7 +1906,7 @@ else sc->hw.mac.forced_speed_duplex = ADVERTISE_100_HALF; break; - case IFM_10_T: + case IFM_10_FL: sc->hw.mac.autoneg = false; sc->hw.phy.autoneg_advertised = 0; if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX)