diff options
author | jhb <jhb@FreeBSD.org> | 2011-01-03 18:28:30 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2011-01-03 18:28:30 +0000 |
commit | be4690f32e7fc9ca8ae00f30d3709d74e3ec9638 (patch) | |
tree | 1793e62d0fbc4c9b2b994466658eb4f1f58e4793 /sys/dev/nfe | |
parent | 4c78089710b5ccf0a0c579c50abd36518cd0921d (diff) | |
download | FreeBSD-src-be4690f32e7fc9ca8ae00f30d3709d74e3ec9638.zip FreeBSD-src-be4690f32e7fc9ca8ae00f30d3709d74e3ec9638.tar.gz |
Add a 'locked' variant of the foo_start() routine and call it directly
from interrupt handlers and watchdog routines instead of queueing a task
to call foo_start().
Reviewed by: yongari
MFC after: 1 month
Diffstat (limited to 'sys/dev/nfe')
-rw-r--r-- | sys/dev/nfe/if_nfe.c | 30 | ||||
-rw-r--r-- | sys/dev/nfe/if_nfevar.h | 1 |
2 files changed, 12 insertions, 19 deletions
diff --git a/sys/dev/nfe/if_nfe.c b/sys/dev/nfe/if_nfe.c index 8e816f6..cac32a4 100644 --- a/sys/dev/nfe/if_nfe.c +++ b/sys/dev/nfe/if_nfe.c @@ -99,8 +99,8 @@ static int nfe_jrxeof(struct nfe_softc *, int, int *); static void nfe_txeof(struct nfe_softc *); static int nfe_encap(struct nfe_softc *, struct mbuf **); static void nfe_setmulti(struct nfe_softc *); -static void nfe_tx_task(void *, int); static void nfe_start(struct ifnet *); +static void nfe_start_locked(struct ifnet *); static void nfe_watchdog(struct ifnet *); static void nfe_init(void *); static void nfe_init_locked(void *); @@ -553,7 +553,6 @@ nfe_attach(device_t dev) error = ENOSPC; goto fail; } - TASK_INIT(&sc->nfe_tx_task, 1, nfe_tx_task, ifp); /* * Allocate Tx and Rx rings. @@ -679,7 +678,6 @@ nfe_detach(device_t dev) ifp->if_flags &= ~IFF_UP; NFE_UNLOCK(sc); callout_drain(&sc->nfe_stat_ch); - taskqueue_drain(taskqueue_fast, &sc->nfe_tx_task); ether_ifdetach(ifp); } @@ -1631,7 +1629,7 @@ nfe_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) rx_npkts = nfe_rxeof(sc, count, &rx_npkts); nfe_txeof(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - taskqueue_enqueue_fast(sc->nfe_tq, &sc->nfe_tx_task); + nfe_start_locked(ifp); if (cmd == POLL_AND_CHECK_STATUS) { if ((r = NFE_READ(sc, sc->nfe_irq_status)) == 0) { @@ -1903,7 +1901,7 @@ nfe_int_task(void *arg, int pending) nfe_txeof(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - taskqueue_enqueue_fast(sc->nfe_tq, &sc->nfe_tx_task); + nfe_start_locked(ifp); NFE_UNLOCK(sc); @@ -2599,29 +2597,27 @@ done: static void -nfe_tx_task(void *arg, int pending) +nfe_start(struct ifnet *ifp) { - struct ifnet *ifp; + struct nfe_softc *sc = ifp->if_softc; - ifp = (struct ifnet *)arg; - nfe_start(ifp); + NFE_LOCK(sc); + nfe_start_locked(ifp); + NFE_UNLOCK(sc); } - static void -nfe_start(struct ifnet *ifp) +nfe_start_locked(struct ifnet *ifp) { struct nfe_softc *sc = ifp->if_softc; struct mbuf *m0; int enq; - NFE_LOCK(sc); + NFE_LOCK_ASSERT(sc); if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING || sc->nfe_link == 0) { - NFE_UNLOCK(sc); + IFF_DRV_RUNNING || sc->nfe_link == 0) return; - } for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd);) { IFQ_DRV_DEQUEUE(&ifp->if_snd, m0); @@ -2651,8 +2647,6 @@ nfe_start(struct ifnet *ifp) */ sc->nfe_watchdog_timer = 5; } - - NFE_UNLOCK(sc); } @@ -2670,7 +2664,7 @@ nfe_watchdog(struct ifnet *ifp) if_printf(ifp, "watchdog timeout (missed Tx interrupts) " "-- recovering\n"); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - taskqueue_enqueue_fast(sc->nfe_tq, &sc->nfe_tx_task); + nfe_start_locked(ifp); return; } /* Check if we've lost start Tx command. */ diff --git a/sys/dev/nfe/if_nfevar.h b/sys/dev/nfe/if_nfevar.h index d2dbb1a..c2e34f1 100644 --- a/sys/dev/nfe/if_nfevar.h +++ b/sys/dev/nfe/if_nfevar.h @@ -139,7 +139,6 @@ struct nfe_softc { struct nfe_hw_stats nfe_stats; struct taskqueue *nfe_tq; struct task nfe_int_task; - struct task nfe_tx_task; int nfe_link; int nfe_suspended; int nfe_framesize; |