Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F160640231
D57566.id179705.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D57566.id179705.diff
View Options
diff --git a/sys/dev/usb/net/if_aue.c b/sys/dev/usb/net/if_aue.c
--- a/sys/dev/usb/net/if_aue.c
+++ b/sys/dev/usb/net/if_aue.c
@@ -500,12 +500,35 @@
{
struct aue_softc *sc = device_get_softc(dev);
struct mii_data *mii = GET_MII(sc);
+ if_t ifp;
int locked;
locked = mtx_owned(&sc->sc_mtx);
if (!locked)
AUE_LOCK(sc);
+ ifp = uether_getifp(&sc->sc_ue);
+ if (mii == NULL || ifp == NULL ||
+ (if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0)
+ goto done;
+
+ sc->sc_flags &= ~AUE_FLAG_LINK;
+ if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
+ (IFM_ACTIVE | IFM_AVALID)) {
+ switch (IFM_SUBTYPE(mii->mii_media_active)) {
+ case IFM_10_T:
+ case IFM_100_TX:
+ sc->sc_flags |= AUE_FLAG_LINK;
+ break;
+ default:
+ break;
+ }
+ }
+
+ /* Lost link, do nothing. */
+ if ((sc->sc_flags & AUE_FLAG_LINK) == 0)
+ goto done;
+
AUE_CLRBIT(sc, AUE_CTL0, AUE_CTL0_RX_ENB | AUE_CTL0_TX_ENB);
if (IFM_SUBTYPE(mii->mii_media_active) == IFM_100_TX)
AUE_SETBIT(sc, AUE_CTL1, AUE_CTL1_SPEEDSEL);
@@ -530,6 +553,7 @@
auxmode = aue_miibus_readreg(dev, 0, 0x1b);
aue_miibus_writereg(dev, 0, 0x1b, auxmode | 0x04);
}
+done:
if (!locked)
AUE_UNLOCK(sc);
}
@@ -940,11 +964,10 @@
AUE_LOCK(sc);
mii_tick(mii);
- if ((sc->sc_flags & AUE_FLAG_LINK) == 0
- && mii->mii_media_status & IFM_ACTIVE &&
- IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) {
- sc->sc_flags |= AUE_FLAG_LINK;
- aue_start(ue);
+ if ((sc->sc_flags & AUE_FLAG_LINK) == 0) {
+ aue_miibus_statchg(ue->ue_dev);
+ if ((sc->sc_flags & AUE_FLAG_LINK) != 0)
+ aue_start(ue);
}
AUE_UNLOCK(sc);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jun 27, 10:11 AM (4 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33963143
Default Alt Text
D57566.id179705.diff (1 KB)
Attached To
Mode
D57566: aue(4): fix incorrect media detection
Attached
Detach File
Event Timeline
Log In to Comment