summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2012-07-31 02:28:32 +0000
committeradrian <adrian@FreeBSD.org>2012-07-31 02:28:32 +0000
commit22fbf81ca5009cec183c0723fae3ec08d382f808 (patch)
tree4fc62b734eaf9d6e63e7537df8cdf0e77ee0a96a
parente538814cc9cc1514eb031c1f7aba478305e43265 (diff)
downloadFreeBSD-src-22fbf81ca5009cec183c0723fae3ec08d382f808.zip
FreeBSD-src-22fbf81ca5009cec183c0723fae3ec08d382f808.tar.gz
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.
-rw-r--r--sys/dev/ath/if_ath_tx.c10
-rw-r--r--sys/dev/ath/if_ath_tx.h5
-rw-r--r--sys/dev/ath/if_ath_tx_edma.c59
3 files changed, 70 insertions, 4 deletions
diff --git a/sys/dev/ath/if_ath_tx.c b/sys/dev/ath/if_ath_tx.c
index 149b4f1..4859bc0 100644
--- a/sys/dev/ath/if_ath_tx.c
+++ b/sys/dev/ath/if_ath_tx.c
@@ -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;
}
diff --git a/sys/dev/ath/if_ath_tx.h b/sys/dev/ath/if_ath_tx.h
index 1bf67c1..edb0b6c 100644
--- a/sys/dev/ath/if_ath_tx.h
+++ b/sys/dev/ath/if_ath_tx.h
@@ -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
diff --git a/sys/dev/ath/if_ath_tx_edma.c b/sys/dev/ath/if_ath_tx_edma.c
index cd8df0d..6d2bae33 100644
--- a/sys/dev/ath/if_ath_tx_edma.c
+++ b/sys/dev/ath/if_ath_tx_edma.c
@@ -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;
}
OpenPOWER on IntegriCloud