diff options
author | jhb <jhb@FreeBSD.org> | 2008-06-03 20:40:33 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2008-06-03 20:40:33 +0000 |
commit | b886479617f2848a4021306691deda0cedbd992e (patch) | |
tree | 0a3156feb0652ae8dce98e7c595b83aae8ee0a9d /sys/dev/xe | |
parent | 925255836af17689c9c0e60c63c6a293e8dc5061 (diff) | |
download | FreeBSD-src-b886479617f2848a4021306691deda0cedbd992e.zip FreeBSD-src-b886479617f2848a4021306691deda0cedbd992e.tar.gz |
- Change the watchdog timer logic to match other drivers that use their own
timer by keeping a once-a-second timer running that decrements a counter
similar to if_timer and reset the chip if it gets down to zero via the
decrement.
- Use IFQ_SET_MAXLEN().
Diffstat (limited to 'sys/dev/xe')
-rw-r--r-- | sys/dev/xe/if_xe.c | 26 | ||||
-rw-r--r-- | sys/dev/xe/if_xevar.h | 1 |
2 files changed, 17 insertions, 10 deletions
diff --git a/sys/dev/xe/if_xe.c b/sys/dev/xe/if_xe.c index ec7f468..39077f7 100644 --- a/sys/dev/xe/if_xe.c +++ b/sys/dev/xe/if_xe.c @@ -247,7 +247,7 @@ xe_attach (device_t dev) scp->ifp->if_ioctl = xe_ioctl; scp->ifp->if_init = xe_init; scp->ifp->if_baudrate = 100000000; - scp->ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&scp->ifp->if_snd, IFQ_MAXLEN); /* Initialise the ifmedia structure */ ifmedia_init(scp->ifm, 0, xe_media_change, xe_media_status); @@ -340,7 +340,7 @@ xe_init_locked(struct xe_softc *scp) { scp->tx_timeouts = 0; scp->tx_thres = 64; scp->tx_min = ETHER_MIN_LEN - ETHER_CRC_LEN; - callout_stop(&scp->wdog_timer); + scp->tx_timeout = 0; /* Soft reset the card */ XE_SELECT_PAGE(0); @@ -430,6 +430,7 @@ xe_init_locked(struct xe_softc *scp) { /* Enable output */ scp->ifp->if_drv_flags |= IFF_DRV_RUNNING; scp->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + callout_reset(&scp->wdog_timer, hz, xe_watchdog, scp); } @@ -490,7 +491,7 @@ xe_start_locked(struct ifnet *ifp) { BPF_MTAP(ifp, mbp); /* In case we don't hear from the card again... */ - callout_reset(&scp->wdog_timer, hz * 5, xe_watchdog, scp); + scp->tx_timeout = 5; scp->tx_queued++; m_freem(mbp); @@ -657,7 +658,7 @@ xe_intr(void *xscp) scp->mibdata.dot3StatsCollFrequencies[coll-1]++; } } - callout_stop(&scp->wdog_timer); + scp->tx_timeout = 0; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } @@ -862,13 +863,17 @@ static void xe_watchdog(void *arg) { struct xe_softc *scp = arg; - device_printf(scp->dev, "watchdog timeout: resetting card\n"); XE_ASSERT_LOCKED(scp); - scp->tx_timeouts++; - scp->ifp->if_oerrors += scp->tx_queued; - xe_stop(scp); - xe_reset(scp); - xe_init_locked(scp); + + if (scp->tx_timeout && --scp->tx_timeout == 0) { + device_printf(scp->dev, "watchdog timeout: resetting card\n"); + scp->tx_timeouts++; + scp->ifp->if_oerrors += scp->tx_queued; + xe_stop(scp); + xe_reset(scp); + xe_init_locked(scp); + callout_reset(&scp->wdog_timer, hz, xe_watchdog, scp); + } } @@ -1240,6 +1245,7 @@ xe_stop(struct xe_softc *scp) { */ scp->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; scp->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + scp->tx_timeout = 0; callout_stop(&scp->wdog_timer); callout_stop(&scp->media_timer); } diff --git a/sys/dev/xe/if_xevar.h b/sys/dev/xe/if_xevar.h index 0981338..15b7b04 100644 --- a/sys/dev/xe/if_xevar.h +++ b/sys/dev/xe/if_xevar.h @@ -37,6 +37,7 @@ struct xe_softc { struct ifmib_iso_8802_3 mibdata; struct callout media_timer; struct callout wdog_timer; + int tx_timeout; struct mtx lock; struct ifnet *ifp; struct ifmedia *ifm; |