Break out the hardware handoff and TX DMA restart code into methods.

These (and a few others) will differ based on the underlying DMA
implementation.

For the EDMA NICs, simply stub them out in a fashion which will let
me focus on implementing the necessary descriptor API changes.
This commit is contained in:
Adrian Chadd 2012-07-31 02:28:32 +00:00
parent 3ba9052674
commit 746bab5b7f
3 changed files with 70 additions and 4 deletions

View File

@ -639,8 +639,8 @@ ath_tx_handoff_hw(struct ath_softc *sc, struct ath_txq *txq,
*
* This must be called whether the queue is empty or not.
*/
void
ath_txq_restart_dma(struct ath_softc *sc, struct ath_txq *txq)
static void
ath_legacy_tx_dma_restart(struct ath_softc *sc, struct ath_txq *txq)
{
struct ath_hal *ah = sc->sc_ah;
struct ath_buf *bf, *bf_last;
@ -668,7 +668,8 @@ ath_txq_restart_dma(struct ath_softc *sc, struct ath_txq *txq)
* The relevant hardware txq should be locked.
*/
static void
ath_tx_handoff(struct ath_softc *sc, struct ath_txq *txq, struct ath_buf *bf)
ath_legacy_xmit_handoff(struct ath_softc *sc, struct ath_txq *txq,
struct ath_buf *bf)
{
ATH_TXQ_LOCK_ASSERT(txq);
@ -4493,4 +4494,7 @@ ath_xmit_setup_legacy(struct ath_softc *sc)
sc->sc_tx.xmit_setup = ath_legacy_dma_txsetup;
sc->sc_tx.xmit_teardown = ath_legacy_dma_txteardown;
sc->sc_tx.xmit_dma_restart = ath_legacy_tx_dma_restart;
sc->sc_tx.xmit_handoff = ath_legacy_xmit_handoff;
}

View File

@ -79,7 +79,6 @@
#define BAW_WITHIN(_start, _bawsz, _seqno) \
((((_seqno) - (_start)) & 4095) < (_bawsz))
extern void ath_txq_restart_dma(struct ath_softc *sc, struct ath_txq *txq);
extern void ath_freetx(struct mbuf *m);
extern void ath_tx_node_flush(struct ath_softc *sc, struct ath_node *an);
extern void ath_tx_txq_drain(struct ath_softc *sc, struct ath_txq *txq);
@ -131,6 +130,10 @@ extern void ath_addba_response_timeout(struct ieee80211_node *ni,
(_sc)->sc_tx.xmit_setup(_sc)
#define ath_txdma_teardown(_sc) \
(_sc)->sc_tx.xmit_teardown(_sc)
#define ath_txq_restart_dma(_sc, _txq) \
(_sc)->sc_tx.xmit_dma_restart((_sc), (_txq))
#define ath_tx_handoff(_sc, _txq, _bf) \
(_sc)->sc_tx.xmit_handoff((_sc), (_txq), (_bf))
extern void ath_xmit_setup_legacy(struct ath_softc *sc);
#endif

View File

@ -130,6 +130,62 @@ __FBSDID("$FreeBSD$");
MALLOC_DECLARE(M_ATHDEV);
/*
* Re-initialise the DMA FIFO with the current contents of
* said FIFO.
*
* 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)
{
device_printf(sc->sc_dev, "%s: called: txq=%p, qnum=%d\n",
__func__,
txq,
txq->axq_qnum);
}
/*
* Handoff this frame to the hardware.
*
* For the multicast queue, this will treat it as a software queue
* and append it to the list, after updating the MORE_DATA flag
* in the previous frame. The cabq processing code will ensure
* that the queue contents gets transferred over.
*
* For the hardware queues, this will queue a frame to the queue
* like before, then populate the FIFO from that. Since the
* EDMA hardware has 8 FIFO slots per TXQ, this ensures that
* frames such as management frames don't get prematurely dropped.
*
* This does imply that a similar flush-hwq-to-fifoq method will
* need to be called from the processq function, before the
* per-node software scheduler is called.
*/
static void
ath_edma_xmit_handoff(struct ath_softc *sc, struct ath_txq *txq,
struct ath_buf *bf)
{
device_printf(sc->sc_dev, "%s: called; bf=%p, txq=%p, qnum=%d\n",
__func__,
bf,
txq,
txq->axq_qnum);
/*
* XXX For now this is a placeholder; free the buffer
* and inform the stack that the TX failed.
*/
ath_tx_default_comp(sc, bf, 1);
}
static int
ath_edma_setup_txfifo(struct ath_softc *sc, int qnum)
{
@ -217,4 +273,7 @@ ath_xmit_setup_edma(struct ath_softc *sc)
sc->sc_tx.xmit_setup = ath_edma_dma_txsetup;
sc->sc_tx.xmit_teardown = ath_edma_dma_txteardown;
sc->sc_tx.xmit_dma_restart = ath_edma_dma_restart;
sc->sc_tx.xmit_handoff = ath_edma_xmit_handoff;
}