summaryrefslogtreecommitdiffstats
path: root/sys/dev/fatm
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2009-11-19 22:06:40 +0000
committerjhb <jhb@FreeBSD.org>2009-11-19 22:06:40 +0000
commitaffabaa85e18565f9c0a68b33c5b0f2e0587f05a (patch)
tree8407585eec2a1c0c6cadd011a7eb682949649bde /sys/dev/fatm
parentd49024b6f48c6368a3af0f695133bdc2a695e281 (diff)
downloadFreeBSD-src-affabaa85e18565f9c0a68b33c5b0f2e0587f05a.zip
FreeBSD-src-affabaa85e18565f9c0a68b33c5b0f2e0587f05a.tar.gz
- Add a private timer to drive the transmit watchdog instead of using
if_watchdog and if_timer. - Fix some issues in detach for sn(4), ste(4), and ti(4). Primarily this means calling ether_ifdetach() before anything else.
Diffstat (limited to 'sys/dev/fatm')
-rw-r--r--sys/dev/fatm/if_fatm.c21
-rw-r--r--sys/dev/fatm/if_fatmvar.h1
2 files changed, 11 insertions, 11 deletions
diff --git a/sys/dev/fatm/if_fatm.c b/sys/dev/fatm/if_fatm.c
index 47a6443..18b619a 100644
--- a/sys/dev/fatm/if_fatm.c
+++ b/sys/dev/fatm/if_fatm.c
@@ -391,16 +391,14 @@ fatm_check_heartbeat(struct fatm_softc *sc)
* Ensure that the heart is still beating.
*/
static void
-fatm_watchdog(struct ifnet *ifp)
+fatm_watchdog(void *arg)
{
- struct fatm_softc *sc = ifp->if_softc;
+ struct fatm_softc *sc;
- FATM_LOCK(sc);
- if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
- fatm_check_heartbeat(sc);
- ifp->if_timer = 5;
- }
- FATM_UNLOCK(sc);
+ sc = arg;
+ FATM_CHECKLOCK(sc);
+ fatm_check_heartbeat(sc);
+ callout_reset(&sc->watchdog_timer, hz * 5, fatm_watchdog, sc);
}
/*
@@ -474,7 +472,7 @@ fatm_stop(struct fatm_softc *sc)
(void)fatm_reset(sc);
/* stop watchdog */
- sc->ifp->if_timer = 0;
+ callout_stop(&sc->watchdog_timer);
if (sc->ifp->if_drv_flags & IFF_DRV_RUNNING) {
sc->ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
@@ -1341,7 +1339,7 @@ fatm_init_locked(struct fatm_softc *sc)
/*
* Start the watchdog timer
*/
- sc->ifp->if_timer = 5;
+ callout_reset(&sc->watchdog_timer, hz * 5, fatm_watchdog, sc);
/* start SUNI */
utopia_start(&sc->utopia);
@@ -2543,6 +2541,7 @@ fatm_detach(device_t dev)
FATM_UNLOCK(sc);
atm_ifdetach(sc->ifp); /* XXX race */
}
+ callout_drain(&sc->watchdog_timer);
if (sc->ih != NULL)
bus_teardown_intr(dev, sc->irqres, sc->ih);
@@ -2784,6 +2783,7 @@ fatm_attach(device_t dev)
cv_init(&sc->cv_regs, "fatm_regs");
sysctl_ctx_init(&sc->sysctl_ctx);
+ callout_init_mtx(&sc->watchdog_timer, &sc->mtx, 0);
/*
* Make the sysctl tree
@@ -2824,7 +2824,6 @@ fatm_attach(device_t dev)
ifp->if_flags = IFF_SIMPLEX;
ifp->if_ioctl = fatm_ioctl;
ifp->if_start = fatm_start;
- ifp->if_watchdog = fatm_watchdog;
ifp->if_init = fatm_init;
ifp->if_linkmib = &IFP2IFATM(sc->ifp)->mib;
ifp->if_linkmiblen = sizeof(IFP2IFATM(sc->ifp)->mib);
diff --git a/sys/dev/fatm/if_fatmvar.h b/sys/dev/fatm/if_fatmvar.h
index 697e915..bcd8759 100644
--- a/sys/dev/fatm/if_fatmvar.h
+++ b/sys/dev/fatm/if_fatmvar.h
@@ -188,6 +188,7 @@ struct fatm_softc {
struct ifnet *ifp; /* common part */
struct mtx mtx; /* lock this structure */
struct ifmedia media; /* media */
+ struct callout watchdog_timer;
int init_state; /* initialisation step */
int memid; /* resource id for card memory */
OpenPOWER on IntegriCloud