diff options
author | Jason Wright <jason@cvs.openbsd.org> | 2002-08-07 00:30:40 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 2002-08-07 00:30:40 +0000 |
commit | 0f8345ab82f76c6b67ce313b730147b8e4169bf8 (patch) | |
tree | 667268d8ad28e370674f062dcc78350402eeea26 /sys/dev | |
parent | 896a80d1294c2825d9256cf3298906bcb2001151 (diff) |
fix if_timer handling:
- only set it to non-zero when at least on packet is enqueued
- zero it if we tx'd at least one packet
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/hme.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/sys/dev/ic/hme.c b/sys/dev/ic/hme.c index c968b7d3514..e1b34fdbd8c 100644 --- a/sys/dev/ic/hme.c +++ b/sys/dev/ic/hme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hme.c,v 1.17 2002/08/06 20:02:26 jason Exp $ */ +/* $OpenBSD: hme.c,v 1.18 2002/08/07 00:30:39 jason Exp $ */ /* $NetBSD: hme.c,v 1.21 2001/07/07 15:59:37 thorpej Exp $ */ /*- @@ -628,7 +628,7 @@ hme_start(ifp) { struct hme_softc *sc = (struct hme_softc *)ifp->if_softc; struct mbuf *m; - int bix; + int bix, cnt = 0; if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) return; @@ -657,10 +657,13 @@ hme_start(ifp) bus_space_write_4(sc->sc_bustag, sc->sc_etx, HME_ETXI_PENDING, HME_ETX_TP_DMAWAKEUP); + cnt++; } - sc->sc_tx_prod = bix; - ifp->if_timer = 5; + if (cnt != 0) { + sc->sc_tx_prod = bix; + ifp->if_timer = 5; + } } /* @@ -673,13 +676,14 @@ hme_tint(sc) struct ifnet *ifp = &sc->sc_arpcom.ac_if; unsigned int ri, txflags; struct hme_sxd *sd; + int cnt = sc->sc_tx_cnt; /* Fetch current position in the transmit ring */ ri = sc->sc_tx_cons; sd = &sc->sc_txd[ri]; for (;;) { - if (sc->sc_tx_cnt <= 0) + if (cnt <= 0) break; txflags = HME_XD_GETFLAGS(sc->sc_pci, sc->sc_rb.rb_txd, ri); @@ -707,7 +711,12 @@ hme_tint(sc) } else sd++; - --sc->sc_tx_cnt; + --cnt; + } + + if (cnt != sc->sc_tx_cnt) { + ifp->if_timer = 0; + sc->sc_tx_cnt = cnt; } /* Update ring */ @@ -715,9 +724,6 @@ hme_tint(sc) hme_start(ifp); - if (sc->sc_tx_cnt == 0) - ifp->if_timer = 0; - return (1); } |