aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/alc
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2011-01-03 18:28:30 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2011-01-03 18:28:30 +0000
commit32341ad63cacae167f86f1ce627384608d04b6d3 (patch)
tree1793e62d0fbc4c9b2b994466658eb4f1f58e4793 /sys/dev/alc
parentb38dc7ebeaf3fd1bc45ad7a2a75673813ba76d61 (diff)
Notes
Diffstat (limited to 'sys/dev/alc')
-rw-r--r--sys/dev/alc/if_alc.c28
-rw-r--r--sys/dev/alc/if_alcvar.h1
2 files changed, 12 insertions, 17 deletions
diff --git a/sys/dev/alc/if_alc.c b/sys/dev/alc/if_alc.c
index dac8d9030b24..9f06921c6bd6 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 ||
diff --git a/sys/dev/alc/if_alcvar.h b/sys/dev/alc/if_alcvar.h
index 7280ca363e0d..3215cefe1a56 100644
--- a/sys/dev/alc/if_alcvar.h
+++ b/sys/dev/alc/if_alcvar.h
@@ -246,7 +246,6 @@ struct alc_softc {
int alc_buf_size;
struct task alc_int_task;
- struct task alc_tx_task;
struct taskqueue *alc_tq;
struct mtx alc_mtx;
};