Date: Wed, 2 Mar 2022 10:33:31 -0500 From: "J.R. Oldroyd" <fbsd@opal.com> To: freebsd-net@freebsd.org Subject: em(4) does not autonegotiate when fixed media is set Message-ID: <20220302103331.3a50e443@opal.com>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
An em(4) interface configured with fixed media/mediatype settings, as in:
ifconfig em0 media 100baseTX mediatype full-duplex
does not respond to autonegotiation from the switch it is connected to.
(Actually, it does for 1000base but not for 100base or 10base.) As a
result, the switch may end up with mis-matched configuration.
Attached patch enables autonegotiation even when media settings are set
to fixed 100base or 10base.
I am not sure if there should also be:
hw->phy.autoneg_wait_to_complete = FALSE;
for these 100base and 10base cases to handle the situation where the other
end isn't going to autonegotiate either.
-jr
[-- Attachment #2 --]
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index b71e64b214c..ae0815e2b65 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -1610,20 +1610,26 @@ em_if_media_change(if_ctx_t ctx)
adapter->hw.phy.autoneg_advertised = ADVERTISE_1000_FULL;
break;
case IFM_100_TX:
- adapter->hw.mac.autoneg = FALSE;
- adapter->hw.phy.autoneg_advertised = 0;
- if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX)
+ adapter->hw.mac.autoneg = DO_AUTO_NEG;
+ if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) {
+ adapter->hw.phy.autoneg_advertised = ADVERTISE_100_FULL;
adapter->hw.mac.forced_speed_duplex = ADVERTISE_100_FULL;
- else
+ }
+ else {
+ adapter->hw.phy.autoneg_advertised = ADVERTISE_100_HALF;
adapter->hw.mac.forced_speed_duplex = ADVERTISE_100_HALF;
+ }
break;
case IFM_10_T:
- adapter->hw.mac.autoneg = FALSE;
- adapter->hw.phy.autoneg_advertised = 0;
- if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX)
+ adapter->hw.mac.autoneg = DO_AUTO_NEG;
+ if ((ifm->ifm_media & IFM_GMASK) == IFM_FDX) {
+ adapter->hw.phy.autoneg_advertised = ADVERTISE_10_FULL;
adapter->hw.mac.forced_speed_duplex = ADVERTISE_10_FULL;
- else
+ }
+ else {
+ adapter->hw.phy.autoneg_advertised = ADVERTISE_10_HALF;
adapter->hw.mac.forced_speed_duplex = ADVERTISE_10_HALF;
+ }
break;
default:
device_printf(adapter->dev, "Unsupported media type\n");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20220302103331.3a50e443>
