summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_sis.c
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2007-02-24 14:27:36 +0000
committerdelphij <delphij@FreeBSD.org>2007-02-24 14:27:36 +0000
commite911872985fca2c7033c262f4dfe2d75624b6a3d (patch)
tree601aa969b609b3d3a9acc4aa0e5d8f4db045cc95 /sys/pci/if_sis.c
parentf7d6019d712e2e33123023272ed073b8e2a3b024 (diff)
downloadFreeBSD-src-e911872985fca2c7033c262f4dfe2d75624b6a3d.zip
FreeBSD-src-e911872985fca2c7033c262f4dfe2d75624b6a3d.tar.gz
Convert sis(4) to use its own watchdog procedure.
Submitted by: Florian C. Smeets <flo kasimir com>
Diffstat (limited to 'sys/pci/if_sis.c')
-rw-r--r--sys/pci/if_sis.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/sys/pci/if_sis.c b/sys/pci/if_sis.c
index 606788c..8902247 100644
--- a/sys/pci/if_sis.c
+++ b/sys/pci/if_sis.c
@@ -137,7 +137,7 @@ static int sis_newbuf(struct sis_softc *, struct sis_desc *, struct mbuf *);
static void sis_start(struct ifnet *);
static void sis_startl(struct ifnet *);
static void sis_stop(struct sis_softc *);
-static void sis_watchdog(struct ifnet *);
+static void sis_watchdog(struct sis_softc *);
static struct resource_spec sis_res_spec[] = {
@@ -1193,7 +1193,6 @@ sis_attach(device_t dev)
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_ioctl = sis_ioctl;
ifp->if_start = sis_start;
- ifp->if_watchdog = sis_watchdog;
ifp->if_init = sis_init;
IFQ_SET_MAXLEN(&ifp->if_snd, SIS_TX_LIST_CNT - 1);
ifp->if_snd.ifq_drv_maxlen = SIS_TX_LIST_CNT - 1;
@@ -1540,7 +1539,7 @@ sis_txeof(struct sis_softc *sc)
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
}
- ifp->if_timer = (sc->sis_tx_cnt == 0) ? 0 : 5;
+ sc->sis_watchdog_timer = (sc->sis_tx_cnt == 0) ? 0 : 5;
return;
}
@@ -1560,6 +1559,8 @@ sis_tick(void *xsc)
mii = device_get_softc(sc->sis_miibus);
mii_tick(mii);
+ sis_watchdog(sc);
+
if (!sc->sis_link && mii->mii_media_status & IFM_ACTIVE &&
IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) {
sc->sis_link++;
@@ -1822,7 +1823,7 @@ sis_startl(struct ifnet *ifp)
/*
* Set a timeout in case the chip goes out to lunch.
*/
- ifp->if_timer = 5;
+ sc->sis_watchdog_timer = 5;
}
}
@@ -2165,29 +2166,27 @@ sis_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
}
static void
-sis_watchdog(struct ifnet *ifp)
+sis_watchdog(struct sis_softc *sc)
{
- struct sis_softc *sc;
-
- sc = ifp->if_softc;
- SIS_LOCK(sc);
+ SIS_LOCK_ASSERT(sc);
if (sc->sis_stopped) {
SIS_UNLOCK(sc);
return;
}
- ifp->if_oerrors++;
- if_printf(ifp, "watchdog timeout\n");
+ if (sc->sis_watchdog_timer == 0 || --sc->sis_watchdog_timer >0)
+ return;
+
+ device_printf(sc->sis_dev, "watchdog timeout\n");
+ sc->sis_ifp->if_oerrors++;
sis_stop(sc);
sis_reset(sc);
sis_initl(sc);
- if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
- sis_startl(ifp);
-
- SIS_UNLOCK(sc);
+ if (!IFQ_DRV_IS_EMPTY(&sc->sis_ifp->if_snd))
+ sis_startl(sc->sis_ifp);
}
/*
@@ -2205,7 +2204,7 @@ sis_stop(struct sis_softc *sc)
return;
SIS_LOCK_ASSERT(sc);
ifp = sc->sis_ifp;
- ifp->if_timer = 0;
+ sc->sis_watchdog_timer = 0;
callout_stop(&sc->sis_stat_ch);
OpenPOWER on IntegriCloud