diff options
author | Marcus Glocker <mglocker@cvs.openbsd.org> | 2006-08-15 12:06:14 +0000 |
---|---|---|
committer | Marcus Glocker <mglocker@cvs.openbsd.org> | 2006-08-15 12:06:14 +0000 |
commit | 8550ecd7b76f1088fe9d0fb9ada953576a40ce3f (patch) | |
tree | 71c440014e3646243c7293205c19cf88e631f1d3 /sys/dev/ic/acx.c | |
parent | b6c71ea1e53a33c1e3428dc37b37d11d187ce716 (diff) |
Improve watchdog handler.
ok jsg@
Diffstat (limited to 'sys/dev/ic/acx.c')
-rw-r--r-- | sys/dev/ic/acx.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/sys/dev/ic/acx.c b/sys/dev/ic/acx.c index b3b13407f65..a7c95f57732 100644 --- a/sys/dev/ic/acx.c +++ b/sys/dev/ic/acx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acx.c,v 1.41 2006/08/14 23:13:28 mglocker Exp $ */ +/* $OpenBSD: acx.c,v 1.42 2006/08/15 12:06:13 mglocker Exp $ */ /* * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org> @@ -1040,16 +1040,34 @@ acx_start(struct ifnet *ifp) ifp->if_flags |= IFF_OACTIVE; if (trans && ifp->if_timer == 0) - ifp->if_timer = 5; + ifp->if_timer = 1; + sc->sc_txtimer = 5; } void acx_watchdog(struct ifnet *ifp) { - printf("%s: watchdog timeout\n", ifp->if_xname); - acx_txeof(ifp->if_softc); + struct acx_softc *sc = ifp->if_softc; + + DPRINTF(("%s: watchdog\n", ifp->if_xname)); + + ifp->if_timer = 0; + + if ((ifp->if_flags & IFF_RUNNING) == 0) + return; + + if (sc->sc_txtimer) { + if (--sc->sc_txtimer == 0) { + printf("%s: watchdog timeout\n", ifp->if_xname); + acx_stop(ifp->if_softc); + acx_init(ifp->if_softc); + ifp->if_oerrors++; + return; + } + ifp->if_timer = 1; + } - /* TODO */ + ieee80211_watchdog(ifp); } int @@ -1152,7 +1170,8 @@ acx_txeof(struct acx_softc *sc) } bd->tx_used_start = idx; - ifp->if_timer = bd->tx_used_count == 0 ? 0 : 5; + ifp->if_timer = bd->tx_used_count == 0 ? 0 : 1; + sc->sc_txtimer = 0; if (bd->tx_used_count != ACX_TX_DESC_CNT) { ifp->if_flags &= ~IFF_OACTIVE; |