Author: yongari
Date: Tue Jan 25 23:27:28 2011
New Revision: 217868
URL: http://svn.freebsd.org/changeset/base/217868

Log:
  Remove TX taskqueue and directly invoke re_start in interrupt task.

Modified:
  head/sys/dev/re/if_re.c
  head/sys/pci/if_rlreg.h

Modified: head/sys/dev/re/if_re.c
==============================================================================
--- head/sys/dev/re/if_re.c     Tue Jan 25 23:25:23 2011        (r217867)
+++ head/sys/dev/re/if_re.c     Tue Jan 25 23:27:28 2011        (r217868)
@@ -254,9 +254,9 @@ static int re_poll_locked   (struct ifnet 
 #endif
 static int re_intr             (void *);
 static void re_tick            (void *);
-static void re_tx_task         (void *, int);
 static void re_int_task                (void *, int);
 static void re_start           (struct ifnet *);
+static void re_start_locked    (struct ifnet *);
 static int re_ioctl            (struct ifnet *, u_long, caddr_t);
 static void re_init            (void *);
 static void re_init_locked     (struct rl_softc *);
@@ -1524,7 +1524,6 @@ re_attach(device_t dev)
        ifp->if_snd.ifq_drv_maxlen = RL_IFQ_MAXLEN;
        IFQ_SET_READY(&ifp->if_snd);
 
-       TASK_INIT(&sc->rl_txtask, 1, re_tx_task, ifp);
        TASK_INIT(&sc->rl_inttask, 0, re_int_task, sc);
 
        /*
@@ -1634,7 +1633,6 @@ re_detach(device_t dev)
                RL_UNLOCK(sc);
                callout_drain(&sc->rl_stat_callout);
                taskqueue_drain(taskqueue_fast, &sc->rl_inttask);
-               taskqueue_drain(taskqueue_fast, &sc->rl_txtask);
                /*
                 * Force off the IFF_UP flag here, in case someone
                 * still had a BPF descriptor attached to this
@@ -2365,7 +2363,7 @@ re_poll_locked(struct ifnet *ifp, enum p
        re_txeof(sc);
 
        if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
-               taskqueue_enqueue_fast(taskqueue_fast, &sc->rl_txtask);
+               re_start_locked(ifp);
 
        if (cmd == POLL_AND_CHECK_STATUS) { /* also check status register */
                u_int16_t       status;
@@ -2468,7 +2466,7 @@ re_int_task(void *arg, int npending)
        }
 
        if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
-               taskqueue_enqueue_fast(taskqueue_fast, &sc->rl_txtask);
+               re_start_locked(ifp);
 
        RL_UNLOCK(sc);
 
@@ -2673,19 +2671,21 @@ re_encap(struct rl_softc *sc, struct mbu
 }
 
 static void
-re_tx_task(void *arg, int npending)
+re_start(struct ifnet *ifp)
 {
-       struct ifnet            *ifp;
+       struct rl_softc         *sc;
 
-       ifp = arg;
-       re_start(ifp);
+       sc = ifp->if_softc;
+       RL_LOCK(sc);
+       re_start_locked(ifp);
+       RL_UNLOCK(sc);
 }
 
 /*
  * Main transmit routine for C+ and gigE NICs.
  */
 static void
-re_start(struct ifnet *ifp)
+re_start_locked(struct ifnet *ifp)
 {
        struct rl_softc         *sc;
        struct mbuf             *m_head;
@@ -2693,13 +2693,9 @@ re_start(struct ifnet *ifp)
 
        sc = ifp->if_softc;
 
-       RL_LOCK(sc);
-
        if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
-           IFF_DRV_RUNNING || (sc->rl_flags & RL_FLAG_LINK) == 0) {
-               RL_UNLOCK(sc);
+           IFF_DRV_RUNNING || (sc->rl_flags & RL_FLAG_LINK) == 0)
                return;
-       }
 
        for (queued = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd) &&
            sc->rl_ldata.rl_tx_free > 1;) {
@@ -2729,7 +2725,6 @@ re_start(struct ifnet *ifp)
                if (sc->rl_ldata.rl_tx_free != sc->rl_ldata.rl_tx_desc_cnt)
                        CSR_WRITE_4(sc, RL_TIMERCNT, 1);
 #endif
-               RL_UNLOCK(sc);
                return;
        }
 
@@ -2757,8 +2752,6 @@ re_start(struct ifnet *ifp)
         * Set a timeout in case the chip goes out to lunch.
         */
        sc->rl_watchdog_timer = 5;
-
-       RL_UNLOCK(sc);
 }
 
 static void
@@ -3278,7 +3271,7 @@ re_watchdog(struct rl_softc *sc)
                if_printf(ifp, "watchdog timeout (missed Tx interrupts) "
                    "-- recovering\n");
                if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
-                       taskqueue_enqueue_fast(taskqueue_fast, &sc->rl_txtask);
+                       re_start_locked(ifp);
                return;
        }
 
@@ -3289,7 +3282,7 @@ re_watchdog(struct rl_softc *sc)
        ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
        re_init_locked(sc);
        if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
-               taskqueue_enqueue_fast(taskqueue_fast, &sc->rl_txtask);
+               re_start_locked(ifp);
 }
 
 /*

Modified: head/sys/pci/if_rlreg.h
==============================================================================
--- head/sys/pci/if_rlreg.h     Tue Jan 25 23:25:23 2011        (r217867)
+++ head/sys/pci/if_rlreg.h     Tue Jan 25 23:27:28 2011        (r217868)
@@ -893,7 +893,6 @@ struct rl_softc {
        int                     rxcycles;
 #endif
 
-       struct task             rl_txtask;
        struct task             rl_inttask;
 
        int                     rl_txstart;
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to