diff options
author | semenu <semenu@FreeBSD.org> | 2002-05-01 19:23:04 +0000 |
---|---|---|
committer | semenu <semenu@FreeBSD.org> | 2002-05-01 19:23:04 +0000 |
commit | 595375107e1cc0ff43c1500a67effd9427887035 (patch) | |
tree | ef434d3fe83748ba2170359ca6549fe54e886f39 /sys/dev/tx | |
parent | 7ba2aa946915a7a5c9d6fb75a548f2834312061d (diff) | |
download | FreeBSD-src-595375107e1cc0ff43c1500a67effd9427887035.zip FreeBSD-src-595375107e1cc0ff43c1500a67effd9427887035.tar.gz |
Add an epic_stats_update() function (called once per second). Even though
we don't collect any stats in it, we mii_tick() in it! This fix the bug
when autonegotiating fullduplex modes.
Also, pause activity before setting TXCON in epic_miibus_statchg(). Though
i've never seen problmes from not doing that, the documentation says we
need to do it.
MFC after: 1 week
Diffstat (limited to 'sys/dev/tx')
-rw-r--r-- | sys/dev/tx/if_tx.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/sys/dev/tx/if_tx.c b/sys/dev/tx/if_tx.c index 716cd96..bb44a87 100644 --- a/sys/dev/tx/if_tx.c +++ b/sys/dev/tx/if_tx.c @@ -140,6 +140,7 @@ static EPIC_INTR_RET_TYPE epic_intr(void *); static int epic_common_attach(epic_softc_t *); static void epic_ifstart(struct ifnet *); static void epic_ifwatchdog(struct ifnet *); +static void epic_stats_update(epic_softc_t *); static int epic_init(epic_softc_t *); static void epic_stop(epic_softc_t *); static void epic_rx_done(epic_softc_t *); @@ -1149,6 +1150,26 @@ epic_ifwatchdog(ifp) } /* + * Despite the name of this function, it doesn't update statistics, it only + * helps in autonegotiation process. + */ +static void +epic_stats_update(epic_softc_t * sc) +{ + struct mii_data * mii; + int s; + + s = splimp(); + + mii = device_get_softc(sc->miibus); + mii_tick(mii); + + sc->stat_ch = timeout((timeout_t *)epic_stats_update, sc, hz); + + splx(s); +} + +/* * Set media options. */ static int @@ -1354,7 +1375,9 @@ epic_miibus_statchg(dev) else sc->sc_if.if_baudrate = 10000000; + epic_stop_activity(sc); epic_set_tx_mode(sc); + epic_start_activity(sc); return; } @@ -1399,7 +1422,6 @@ epic_init(sc) epic_softc_t *sc; { struct ifnet *ifp = &sc->sc_if; - struct mii_data *mii; int s,i; s = splimp(); @@ -1475,17 +1497,11 @@ epic_init(sc) /* Start Rx process */ epic_start_activity(sc); - /* Reset all PHYs */ - mii = device_get_softc(sc->miibus); - if (mii->mii_instance) { - struct mii_softc *miisc; - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - mii_phy_reset(miisc); - } - /* Set appropriate media */ epic_ifmedia_upd(ifp); + sc->stat_ch = timeout((timeout_t *)epic_stats_update, sc, hz); + splx(s); return 0; @@ -1724,6 +1740,8 @@ epic_stop(sc) sc->sc_if.if_timer = 0; + untimeout((timeout_t *)epic_stats_update, sc, sc->stat_ch); + /* Disable interrupts */ CSR_WRITE_4( sc, INTMASK, 0 ); CSR_WRITE_4( sc, GENCTL, 0 ); |