diff options
Diffstat (limited to 'sys/dev/alc/if_alc.c')
-rw-r--r-- | sys/dev/alc/if_alc.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/sys/dev/alc/if_alc.c b/sys/dev/alc/if_alc.c index dac8d90..9f06921 100644 --- a/sys/dev/alc/if_alc.c +++ b/sys/dev/alc/if_alc.c @@ -159,6 +159,7 @@ static void alc_setlinkspeed(struct alc_softc *); static void alc_setwol(struct alc_softc *); static int alc_shutdown(device_t); static void alc_start(struct ifnet *); +static void alc_start_locked(struct ifnet *); static void alc_start_queue(struct alc_softc *); static void alc_stats_clear(struct alc_softc *); static void alc_stats_update(struct alc_softc *); @@ -168,7 +169,6 @@ static void alc_stop_queue(struct alc_softc *); static int alc_suspend(device_t); static void alc_sysctl_node(struct alc_softc *); static void alc_tick(void *); -static void alc_tx_task(void *, int); static void alc_txeof(struct alc_softc *); static void alc_watchdog(struct alc_softc *); static int sysctl_int_range(SYSCTL_HANDLER_ARGS, int, int); @@ -1002,7 +1002,6 @@ alc_attach(device_t dev) ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); /* Create local taskq. */ - TASK_INIT(&sc->alc_tx_task, 1, alc_tx_task, ifp); sc->alc_tq = taskqueue_create_fast("alc_taskq", M_WAITOK, taskqueue_thread_enqueue, &sc->alc_tq); if (sc->alc_tq == NULL) { @@ -1059,7 +1058,6 @@ alc_detach(device_t dev) ALC_UNLOCK(sc); callout_drain(&sc->alc_tick_ch); taskqueue_drain(sc->alc_tq, &sc->alc_int_task); - taskqueue_drain(sc->alc_tq, &sc->alc_tx_task); ether_ifdetach(ifp); } @@ -2237,16 +2235,18 @@ alc_encap(struct alc_softc *sc, struct mbuf **m_head) } static void -alc_tx_task(void *arg, int pending) +alc_start(struct ifnet *ifp) { - struct ifnet *ifp; + struct alc_softc *sc; - ifp = (struct ifnet *)arg; - alc_start(ifp); + sc = ifp->if_softc; + ALC_LOCK(sc); + alc_start_locked(ifp); + ALC_UNLOCK(sc); } static void -alc_start(struct ifnet *ifp) +alc_start_locked(struct ifnet *ifp) { struct alc_softc *sc; struct mbuf *m_head; @@ -2254,17 +2254,15 @@ alc_start(struct ifnet *ifp) sc = ifp->if_softc; - ALC_LOCK(sc); + ALC_LOCK_ASSERT(sc); /* Reclaim transmitted frames. */ if (sc->alc_cdata.alc_tx_cnt >= ALC_TX_DESC_HIWAT) alc_txeof(sc); if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING || (sc->alc_flags & ALC_FLAG_LINK) == 0) { - ALC_UNLOCK(sc); + IFF_DRV_RUNNING || (sc->alc_flags & ALC_FLAG_LINK) == 0) return; - } for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd); ) { IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); @@ -2303,8 +2301,6 @@ alc_start(struct ifnet *ifp) /* Set a timeout in case the chip goes out to lunch. */ sc->alc_watchdog_timer = ALC_TX_TIMEOUT; } - - ALC_UNLOCK(sc); } static void @@ -2330,7 +2326,7 @@ alc_watchdog(struct alc_softc *sc) ifp->if_drv_flags &= ~IFF_DRV_RUNNING; alc_init_locked(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - taskqueue_enqueue(sc->alc_tq, &sc->alc_tx_task); + alc_start_locked(ifp); } static int @@ -2710,7 +2706,7 @@ alc_int_task(void *arg, int pending) } if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0 && !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - taskqueue_enqueue(sc->alc_tq, &sc->alc_tx_task); + alc_start_locked(ifp); } if (more == EAGAIN || |