diff options
author | adrian <adrian@FreeBSD.org> | 2012-11-08 18:11:31 +0000 |
---|---|---|
committer | adrian <adrian@FreeBSD.org> | 2012-11-08 18:11:31 +0000 |
commit | 2092e733094d0625768a248a7322b6457b81ae8f (patch) | |
tree | 5748256693582a5156ed3a762f0252b6854672b2 /sys/dev/ath/if_ath_tx_edma.c | |
parent | 58a78bc1d751c4b99a36f956bf35766de093ab59 (diff) | |
download | FreeBSD-src-2092e733094d0625768a248a7322b6457b81ae8f.zip FreeBSD-src-2092e733094d0625768a248a7322b6457b81ae8f.tar.gz |
Add some hooks into the driver to attach, detach and record EDMA descriptor
events.
This is primarily for the TX EDMA and TX EDMA completion. I haven't yet
tied it into the EDMA RX path or the legacy TX/RX path.
Things that I don't quite like:
* Make the pointer type 'void' in ath_softc and have if_ath_alq*()
return a malloc'ed buffer. That would remove the need to include
if_ath_alq.h in if_athvar.h.
* The sysctl setup needs to be cleaned up.
Diffstat (limited to 'sys/dev/ath/if_ath_tx_edma.c')
-rw-r--r-- | sys/dev/ath/if_ath_tx_edma.c | 59 |
1 files changed, 52 insertions, 7 deletions
diff --git a/sys/dev/ath/if_ath_tx_edma.c b/sys/dev/ath/if_ath_tx_edma.c index 57e180b..e23c99a 100644 --- a/sys/dev/ath/if_ath_tx_edma.c +++ b/sys/dev/ath/if_ath_tx_edma.c @@ -117,6 +117,10 @@ __FBSDID("$FreeBSD$"); #include <dev/ath/if_ath_tx_edma.h> +#ifdef ATH_DEBUG_ALQ +#include <dev/ath/if_ath_alq.h> +#endif + /* * some general macros */ @@ -132,6 +136,37 @@ MALLOC_DECLARE(M_ATHDEV); static void ath_edma_tx_processq(struct ath_softc *sc, int dosched); +#ifdef ATH_DEBUG_ALQ +static void +ath_edma_tx_alq_post(struct ath_softc *sc, struct ath_buf *bf_first) +{ + struct ath_buf *bf; + int i, n; + const char *ds; + + /* XXX we should skip out early if debugging isn't enabled! */ + bf = bf_first; + + while (bf != NULL) { + /* XXX assume nmaps = 4! */ + /* XXX should ensure bf_nseg > 0! */ + if (bf->bf_nseg == 0) + break; + n = ((bf->bf_nseg - 1) / 4) + 1; + for (i = 0, ds = (const char *) bf->bf_desc; + i < n; + i++, ds += sc->sc_tx_desclen) { + if_ath_alq_post(&sc->sc_alq, + ATH_ALQ_EDMA_TXDESC, + 96, + ds); + } + + bf = bf->bf_next; + } +} +#endif /* ATH_DEBUG_ALQ */ + static void ath_edma_tx_fifo_fill(struct ath_softc *sc, struct ath_txq *txq) { @@ -149,7 +184,11 @@ ath_edma_tx_fifo_fill(struct ath_softc *sc, struct ath_txq *txq) #ifdef ATH_DEBUG if (sc->sc_debug & ATH_DEBUG_XMIT_DESC) ath_printtxbuf(sc, bf, txq->axq_qnum, i, 0); -#endif +#endif/* ATH_DEBUG */ +#ifdef ATH_DEBUG_ALQ + if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_EDMA_TXDESC)) + ath_edma_tx_alq_post(sc, bf); +#endif /* ATH_DEBUG_ALQ */ txq->axq_fifo_depth++; i++; } @@ -163,10 +202,6 @@ ath_edma_tx_fifo_fill(struct ath_softc *sc, struct ath_txq *txq) * * This should only be called as part of the chip reset path, as it * assumes the FIFO is currently empty. - * - * TODO: verify that a cold/warm reset does clear the TX FIFO, so - * writing in a partially-filled FIFO will not cause double-entries - * to appear. */ static void ath_edma_dma_restart(struct ath_softc *sc, struct ath_txq *txq) @@ -222,7 +257,11 @@ ath_edma_xmit_handoff_hw(struct ath_softc *sc, struct ath_txq *txq, #ifdef ATH_DEBUG if (sc->sc_debug & ATH_DEBUG_XMIT_DESC) ath_printtxbuf(sc, bf, txq->axq_qnum, 0, 0); -#endif /* ATH_DEBUG */ +#endif /* ATH_DEBUG */ +#ifdef ATH_DEBUG_ALQ + if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_EDMA_TXDESC)) + ath_edma_tx_alq_post(sc, bf); +#endif /* ATH_DEBUG_ALQ */ ath_hal_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr); txq->axq_fifo_depth++; ath_hal_txstart(ah, txq->axq_qnum); @@ -368,7 +407,6 @@ ath_edma_dma_txsetup(struct ath_softc *sc) ath_edma_setup_txfifo(sc, i); } - return (0); } @@ -489,6 +527,13 @@ ath_edma_tx_processq(struct ath_softc *sc, int dosched) continue; } +#ifdef ATH_DEBUG_ALQ + if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_EDMA_TXSTATUS)) + if_ath_alq_post(&sc->sc_alq, ATH_ALQ_EDMA_TXSTATUS, + sc->sc_tx_statuslen, + (char *) txstatus); +#endif /* ATH_DEBUG_ALQ */ + /* * At this point we have a valid status descriptor. * The QID and descriptor ID (which currently isn't set) |