diff options
author | mlaier <mlaier@FreeBSD.org> | 2004-07-02 12:16:02 +0000 |
---|---|---|
committer | mlaier <mlaier@FreeBSD.org> | 2004-07-02 12:16:02 +0000 |
commit | 7bc770a2546e8a5f93ee931634d4064b3b6e08f2 (patch) | |
tree | 65f0224543a217107b8c639eebd90136c5b1386d /sys/dev | |
parent | 1ddf2fdcc0eaea7a1f7848fe9957f173c396c23c (diff) | |
download | FreeBSD-src-7bc770a2546e8a5f93ee931634d4064b3b6e08f2.zip FreeBSD-src-7bc770a2546e8a5f93ee931634d4064b3b6e08f2.tar.gz |
Bring in the first chunk of altq driver modifications. This covers the
following drivers: bfe(4), em(4), fxp(4), lnc(4), tun(4), de(4) rl(4),
sis(4) and xl(4)
More patches are pending on: http://peoples.freebsd.org/~mlaier/ Please take
a look and tell me if "your" driver is missing, so I can fix this.
Tested-by: many
No-objection: -current, -net
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/bfe/if_bfe.c | 10 | ||||
-rw-r--r-- | sys/dev/de/if_de.c | 23 | ||||
-rw-r--r-- | sys/dev/em/if_em.c | 14 | ||||
-rw-r--r-- | sys/dev/fxp/if_fxp.c | 13 | ||||
-rw-r--r-- | sys/dev/lnc/if_lnc.c | 6 |
5 files changed, 41 insertions, 25 deletions
diff --git a/sys/dev/bfe/if_bfe.c b/sys/dev/bfe/if_bfe.c index a3a44dc..7a39b4c 100644 --- a/sys/dev/bfe/if_bfe.c +++ b/sys/dev/bfe/if_bfe.c @@ -402,7 +402,9 @@ bfe_attach(device_t dev) ifp->if_init = bfe_init; ifp->if_mtu = ETHERMTU; ifp->if_baudrate = 100000000; - ifp->if_snd.ifq_maxlen = BFE_TX_QLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, BFE_TX_QLEN); + ifp->if_snd.ifq_drv_maxlen = BFE_TX_QLEN; + IFQ_SET_READY(&ifp->if_snd); bfe_get_config(sc); @@ -1256,7 +1258,7 @@ bfe_intr(void *xsc) bfe_txeof(sc); /* We have packets pending, fire them out */ - if (ifp->if_flags & IFF_RUNNING && ifp->if_snd.ifq_head != NULL) + if (ifp->if_flags & IFF_RUNNING && !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) bfe_start(ifp); BFE_UNLOCK(sc); @@ -1375,7 +1377,7 @@ bfe_start(struct ifnet *ifp) } while(sc->bfe_tx_ring[idx].bfe_mbuf == NULL) { - IF_DEQUEUE(&ifp->if_snd, m_head); + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); if(m_head == NULL) break; @@ -1384,7 +1386,7 @@ bfe_start(struct ifnet *ifp) * enough room, let the chip drain the ring. */ if(bfe_encap(sc, m_head, &idx)) { - IF_PREPEND(&ifp->if_snd, m_head); + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); ifp->if_flags |= IFF_OACTIVE; break; } diff --git a/sys/dev/de/if_de.c b/sys/dev/de/if_de.c index a56f1b8..6c3592e 100644 --- a/sys/dev/de/if_de.c +++ b/sys/dev/de/if_de.c @@ -4619,15 +4619,17 @@ tulip_ifstart( if ((sc->tulip_flags & (TULIP_WANTSETUP|TULIP_TXPROBE_ACTIVE)) == TULIP_WANTSETUP) tulip_txput_setup(sc); - while (sc->tulip_if.if_snd.ifq_head != NULL) { + while (!IFQ_DRV_IS_EMPTY(&sc->tulip_if.if_snd)) { struct mbuf *m; - IF_DEQUEUE(&sc->tulip_if.if_snd, m); + IFQ_DRV_DEQUEUE(&sc->tulip_if.if_snd, m); + if(m == NULL) + break; if ((m = tulip_txput(sc, m)) != NULL) { - IF_PREPEND(&sc->tulip_if.if_snd, m); + IFQ_DRV_PREPEND(&sc->tulip_if.if_snd, m); break; } } - if (sc->tulip_if.if_snd.ifq_head == NULL) + if (IFQ_DRV_IS_EMPTY(&sc->tulip_if.if_snd)) sc->tulip_if.if_start = tulip_ifstart_one; } @@ -4642,11 +4644,12 @@ tulip_ifstart_one( tulip_softc_t * const sc = (tulip_softc_t *)ifp->if_softc; if ((sc->tulip_if.if_flags & IFF_RUNNING) - && sc->tulip_if.if_snd.ifq_head != NULL) { + && !IFQ_DRV_IS_EMPTY(&sc->tulip_if.if_snd)) { struct mbuf *m; - IF_DEQUEUE(&sc->tulip_if.if_snd, m); - if ((m = tulip_txput(sc, m)) != NULL) - IF_PREPEND(&sc->tulip_if.if_snd, m); + IFQ_DRV_DEQUEUE(&sc->tulip_if.if_snd, m); + if(m == NULL); + else if((m = tulip_txput(sc, m)) != NULL) + IFQ_DRV_PREPEND(&sc->tulip_if.if_snd, m); } TULIP_PERFEND(ifstart_one); } @@ -4788,7 +4791,9 @@ tulip_attach( tulip_reset(sc); ether_ifattach(&(sc)->tulip_if, sc->tulip_enaddr); - ifp->if_snd.ifq_maxlen = ifqmaxlen; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; + IFQ_SET_READY(&ifp->if_snd); } #if defined(TULIP_BUS_DMA) diff --git a/sys/dev/em/if_em.c b/sys/dev/em/if_em.c index 47eb067..28aafa4 100644 --- a/sys/dev/em/if_em.c +++ b/sys/dev/em/if_em.c @@ -610,15 +610,15 @@ em_start_locked(struct ifnet *ifp) if (!adapter->link_active) return; - while (ifp->if_snd.ifq_head != NULL) { + while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { - IF_DEQUEUE(&ifp->if_snd, m_head); + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; if (em_encap(adapter, m_head)) { ifp->if_flags |= IFF_OACTIVE; - IF_PREPEND(&ifp->if_snd, m_head); + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); break; } @@ -918,7 +918,7 @@ em_poll_locked(struct ifnet *ifp, enum poll_cmd cmd, int count) em_clean_transmit_interrupts(adapter); } - if (ifp->if_flags & IFF_RUNNING && ifp->if_snd.ifq_head != NULL) + if (ifp->if_flags & IFF_RUNNING && !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) em_start_locked(ifp); } @@ -988,7 +988,7 @@ em_intr(void *arg) loop_cnt--; } - if (ifp->if_flags & IFF_RUNNING && ifp->if_snd.ifq_head != NULL) + if (ifp->if_flags & IFF_RUNNING && IFQ_DRV_IS_EMPTY(&ifp->if_snd)) em_start_locked(ifp); EM_UNLOCK(adapter); @@ -1854,7 +1854,9 @@ em_setup_interface(device_t dev, struct adapter * adapter) ifp->if_ioctl = em_ioctl; ifp->if_start = em_start; ifp->if_watchdog = em_watchdog; - ifp->if_snd.ifq_maxlen = adapter->num_tx_desc - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, adapter->num_tx_desc - 1); + ifp->if_snd.ifq_drv_maxlen = adapter->num_tx_desc - 1; + IFQ_SET_READY(&ifp->if_snd); #if __FreeBSD_version < 500000 ether_ifattach(ifp, ETHER_BPF_SUPPORTED); diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c index 6dc1aa6..65de7e1 100644 --- a/sys/dev/fxp/if_fxp.c +++ b/sys/dev/fxp/if_fxp.c @@ -796,7 +796,9 @@ fxp_attach(device_t dev) * Let the system queue as many packets as we have available * TX descriptors. */ - ifp->if_snd.ifq_maxlen = FXP_NTXCB - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, FXP_NTXCB - 1); + ifp->if_snd.ifq_drv_maxlen = FXP_NTXCB - 1; + IFQ_SET_READY(&ifp->if_snd); /* * Hook our interrupt after all initialization is complete. @@ -1278,12 +1280,15 @@ fxp_start_body(struct ifnet *ifp) * NOTE: One TxCB is reserved to guarantee that fxp_mc_setup() can add * a NOP command when needed. */ - while (ifp->if_snd.ifq_head != NULL && sc->tx_queued < FXP_NTXCB - 1) { + while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd) && + sc->tx_queued < FXP_NTXCB - 1) { /* * Grab a packet to transmit. */ - IF_DEQUEUE(&ifp->if_snd, mb_head); + IFQ_DRV_DEQUEUE(&ifp->if_snd, mb_head); + if (mb_head == NULL) + break; /* * Get pointer to next available tx desc. @@ -1634,7 +1639,7 @@ fxp_intr_body(struct fxp_softc *sc, struct ifnet *ifp, u_int8_t statack, /* * Try to start more packets transmitting. */ - if (ifp->if_snd.ifq_head != NULL) + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) fxp_start_body(ifp); } diff --git a/sys/dev/lnc/if_lnc.c b/sys/dev/lnc/if_lnc.c index 25cb687..8e80530 100644 --- a/sys/dev/lnc/if_lnc.c +++ b/sys/dev/lnc/if_lnc.c @@ -863,7 +863,9 @@ lnc_attach_common(device_t dev) sc->arpcom.ac_if.if_ioctl = lnc_ioctl; sc->arpcom.ac_if.if_watchdog = lnc_watchdog; sc->arpcom.ac_if.if_init = lnc_init; - sc->arpcom.ac_if.if_snd.ifq_maxlen = IFQ_MAXLEN; + IFQ_SET_MAXLEN(&sc->arpcom.ac_if.if_snd, IFQ_MAXLEN); + sc->arpcom.ac_if.if_snd.ifq_drv_maxlen = IFQ_MAXLEN; + IFQ_SET_READY(&sc->arpcom.ac_if.if_snd); /* Extract MAC address from PROM */ for (i = 0; i < ETHER_ADDR_LEN; i++) @@ -1213,7 +1215,7 @@ lnc_start(struct ifnet *ifp) do { - IF_DEQUEUE(&sc->arpcom.ac_if.if_snd, head); + IFQ_DRV_DEQUEUE(&sc->arpcom.ac_if.if_snd, head); if (!head) return; |