diff options
author | mlaier <mlaier@FreeBSD.org> | 2005-03-12 17:35:37 +0000 |
---|---|---|
committer | mlaier <mlaier@FreeBSD.org> | 2005-03-12 17:35:37 +0000 |
commit | 923d1a6714d8dec976440f3dcbf98c0ba45b6bf7 (patch) | |
tree | 2baccad73a4d1f191dcb219b920ac5326cdbe633 | |
parent | 24a06782ed706d41ac22a33c7bb277cc49931e12 (diff) | |
download | FreeBSD-src-923d1a6714d8dec976440f3dcbf98c0ba45b6bf7.zip FreeBSD-src-923d1a6714d8dec976440f3dcbf98c0ba45b6bf7.tar.gz |
ALTQ support for re(4).
Submitted by: Chris Dionissopoulos, Theo Schlossnagle
PR: kern/78681
MFC after: 2 weeks
-rw-r--r-- | share/man/man4/altq.4 | 3 | ||||
-rw-r--r-- | sys/dev/re/if_re.c | 20 |
2 files changed, 16 insertions, 7 deletions
diff --git a/share/man/man4/altq.4 b/share/man/man4/altq.4 index 023d949..e242d58 100644 --- a/share/man/man4/altq.4 +++ b/share/man/man4/altq.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 7, 2005 +.Dd March 12, 2005 .Dt ALTQ 4 .Os .Sh NAME @@ -127,6 +127,7 @@ They have been applied to the following hardware drivers: .Xr fxp 4 , .Xr hme 4 , .Xr lnc 4 , +.Xr re 4 , .Xr rl 4 , .Xr sf 4 , .Xr sis 4 , diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c index 77f2942..d458aa7 100644 --- a/sys/dev/re/if_re.c +++ b/sys/dev/re/if_re.c @@ -717,6 +717,7 @@ re_diag(sc) CSR_WRITE_2(sc, RL_ISR, 0xFFFF); RL_UNLOCK(sc); + /* XXX: re_diag must not be called when in ALTQ mode */ IF_HANDOFF(&ifp->if_snd, m0, ifp); RL_LOCK(sc); m0 = NULL; @@ -1206,7 +1207,9 @@ re_attach(dev) ifp->if_baudrate = 1000000000; else ifp->if_baudrate = 100000000; - ifp->if_snd.ifq_maxlen = RL_IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, RL_IFQ_MAXLEN); + ifp->if_snd.ifq_drv_maxlen = RL_IFQ_MAXLEN; + IFQ_SET_READY(&ifp->if_snd); ifp->if_capenable = ifp->if_capabilities & ~IFCAP_HWCSUM; callout_handle_init(&sc->rl_stat_ch); @@ -1788,7 +1791,7 @@ re_poll_locked(struct ifnet *ifp, enum poll_cmd cmd, int count) re_rxeof(sc); re_txeof(sc); - if (ifp->if_snd.ifq_head != NULL) + if (!IFQ_DRV_IS_EMPTY(ifp->if_snd)) re_start_locked(ifp); if (cmd == POLL_AND_CHECK_STATUS) { /* also check status register */ @@ -1872,7 +1875,7 @@ re_intr(arg) } } - if (ifp->if_snd.ifq_head != NULL) + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) re_start_locked(ifp); done_locked: @@ -2009,7 +2012,7 @@ re_start_locked(ifp) { struct rl_softc *sc; struct mbuf *m_head = NULL; - int idx; + int idx, queued = 0; sc = ifp->if_softc; @@ -2018,12 +2021,12 @@ re_start_locked(ifp) idx = sc->rl_ldata.rl_tx_prodidx; while (sc->rl_ldata.rl_tx_mbuf[idx] == NULL) { - IF_DEQUEUE(&ifp->if_snd, m_head); + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; if (re_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; } @@ -2033,8 +2036,13 @@ re_start_locked(ifp) * to him. */ BPF_MTAP(ifp, m_head); + + queued++; } + if (queued == 0) + return; + /* Flush the TX descriptors */ bus_dmamap_sync(sc->rl_ldata.rl_tx_list_tag, |