summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2012-07-31 03:09:48 +0000
committeradrian <adrian@FreeBSD.org>2012-07-31 03:09:48 +0000
commitc9862ba17f9dbc205f208081134987757fefeb41 (patch)
tree4335166277246149129805cc35cf6ea4c675523e
parent22fbf81ca5009cec183c0723fae3ec08d382f808 (diff)
downloadFreeBSD-src-c9862ba17f9dbc205f208081134987757fefeb41.zip
FreeBSD-src-c9862ba17f9dbc205f208081134987757fefeb41.tar.gz
Migrate some more TX side setup routines to be methods.
-rw-r--r--sys/dev/ath/if_ath.c47
-rw-r--r--sys/dev/ath/if_ath_misc.h6
-rw-r--r--sys/dev/ath/if_ath_tx.c3
-rw-r--r--sys/dev/ath/if_ath_tx.h5
-rw-r--r--sys/dev/ath/if_ath_tx_edma.c32
-rw-r--r--sys/dev/ath/if_athvar.h11
6 files changed, 86 insertions, 18 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index a9e76ca..63ef2cf 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -254,6 +254,28 @@ SYSCTL_INT(_hw_ath, OID_AUTO, bstuck, CTLFLAG_RW, &ath_bstuck_threshold,
MALLOC_DEFINE(M_ATHDEV, "athdev", "ath driver dma buffers");
+void
+ath_legacy_attach_comp_func(struct ath_softc *sc)
+{
+
+ /*
+ * Special case certain configurations. Note the
+ * CAB queue is handled by these specially so don't
+ * include them when checking the txq setup mask.
+ */
+ switch (sc->sc_txqsetup &~ (1<<sc->sc_cabq->axq_qnum)) {
+ case 0x01:
+ TASK_INIT(&sc->sc_txtask, 0, ath_tx_proc_q0, sc);
+ break;
+ case 0x0f:
+ TASK_INIT(&sc->sc_txtask, 0, ath_tx_proc_q0123, sc);
+ break;
+ default:
+ TASK_INIT(&sc->sc_txtask, 0, ath_tx_proc, sc);
+ break;
+ }
+}
+
#define HAL_MODE_HT20 (HAL_MODE_11NG_HT20 | HAL_MODE_11NA_HT20)
#define HAL_MODE_HT40 \
(HAL_MODE_11NG_HT40PLUS | HAL_MODE_11NG_HT40MINUS | \
@@ -460,21 +482,12 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
}
/*
- * Special case certain configurations. Note the
- * CAB queue is handled by these specially so don't
- * include them when checking the txq setup mask.
+ * Attach the TX completion function.
+ *
+ * The non-EDMA chips may have some special case optimisations;
+ * this method gives everyone a chance to attach cleanly.
*/
- switch (sc->sc_txqsetup &~ (1<<sc->sc_cabq->axq_qnum)) {
- case 0x01:
- TASK_INIT(&sc->sc_txtask, 0, ath_tx_proc_q0, sc);
- break;
- case 0x0f:
- TASK_INIT(&sc->sc_txtask, 0, ath_tx_proc_q0123, sc);
- break;
- default:
- TASK_INIT(&sc->sc_txtask, 0, ath_tx_proc, sc);
- break;
- }
+ sc->sc_tx.xmit_attach_comp_func(sc);
/*
* Setup rate control. Some rate control modules
@@ -3563,8 +3576,8 @@ ath_tx_update_busy(struct ath_softc *sc)
* Kick the packet scheduler if needed. This can occur from this
* particular task.
*/
-static int
-ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq, int dosched)
+int
+ath_legacy_tx_processq(struct ath_softc *sc, struct ath_txq *txq, int dosched)
{
struct ath_hal *ah = sc->sc_ah;
struct ath_buf *bf;
@@ -3964,7 +3977,7 @@ ath_tx_freebuf(struct ath_softc *sc, struct ath_buf *bf, int status)
}
void
-ath_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq)
+ath_legacy_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq)
{
#ifdef ATH_DEBUG
struct ath_hal *ah = sc->sc_ah;
diff --git a/sys/dev/ath/if_ath_misc.h b/sys/dev/ath/if_ath_misc.h
index a629cba..d34c72c 100644
--- a/sys/dev/ath/if_ath_misc.h
+++ b/sys/dev/ath/if_ath_misc.h
@@ -66,7 +66,6 @@ extern void ath_returnbuf_head(struct ath_softc *sc, struct ath_buf *bf);
extern void ath_returnbuf_tail(struct ath_softc *sc, struct ath_buf *bf);
extern int ath_reset(struct ifnet *, ATH_RESET_TYPE);
-extern void ath_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq);
extern void ath_tx_default_comp(struct ath_softc *sc, struct ath_buf *bf,
int fail);
extern void ath_tx_update_ratectrl(struct ath_softc *sc,
@@ -96,6 +95,11 @@ extern int ath_descdma_setup_rx_edma(struct ath_softc *sc,
extern void ath_descdma_cleanup(struct ath_softc *sc,
struct ath_descdma *dd, ath_bufhead *head);
+extern void ath_legacy_attach_comp_func(struct ath_softc *sc);
+extern void ath_legacy_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq);
+extern int ath_legacy_tx_processq(struct ath_softc *sc, struct ath_txq *txq,
+ int dosched);
+
/*
* This is only here so that the RX proc function can call it.
* It's very likely that the "start TX after RX" call should be
diff --git a/sys/dev/ath/if_ath_tx.c b/sys/dev/ath/if_ath_tx.c
index 4859bc0..024ed2e 100644
--- a/sys/dev/ath/if_ath_tx.c
+++ b/sys/dev/ath/if_ath_tx.c
@@ -4494,7 +4494,10 @@ 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_attach_comp_func = ath_legacy_attach_comp_func;
sc->sc_tx.xmit_dma_restart = ath_legacy_tx_dma_restart;
sc->sc_tx.xmit_handoff = ath_legacy_xmit_handoff;
+ sc->sc_tx.xmit_processq = ath_legacy_tx_processq;
+ sc->sc_tx.xmit_drainq = ath_legacy_tx_draintxq;
}
diff --git a/sys/dev/ath/if_ath_tx.h b/sys/dev/ath/if_ath_tx.h
index edb0b6c..4ac4589 100644
--- a/sys/dev/ath/if_ath_tx.h
+++ b/sys/dev/ath/if_ath_tx.h
@@ -134,6 +134,11 @@ extern void ath_addba_response_timeout(struct ieee80211_node *ni,
(_sc)->sc_tx.xmit_dma_restart((_sc), (_txq))
#define ath_tx_handoff(_sc, _txq, _bf) \
(_sc)->sc_tx.xmit_handoff((_sc), (_txq), (_bf))
+#define ath_tx_draintxq(_sc, _txq) \
+ (_sc)->sc_tx.xmit_drainq((_sc), (_txq))
+#define ath_tx_processq(_sc, _txq, _dosched) \
+ (_sc)->sc_tx.xmit_processq((_sc), (_txq), (_dosched))
+
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 6d2bae33..5991d1c 100644
--- a/sys/dev/ath/if_ath_tx_edma.c
+++ b/sys/dev/ath/if_ath_tx_edma.c
@@ -255,6 +255,35 @@ ath_edma_dma_txteardown(struct ath_softc *sc)
return (0);
}
+static int
+ath_edma_tx_processq(struct ath_softc *sc, struct ath_txq *txq, int dosched)
+{
+
+ return (0);
+}
+
+static void
+ath_edma_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq)
+{
+
+}
+
+static void
+ath_edma_tx_proc(void *arg, int npending)
+{
+ struct ath_softc *sc = (struct ath_softc *) arg;
+
+ device_printf(sc->sc_dev, "%s: called, npending=%d\n",
+ __func__, npending);
+}
+
+static void
+ath_edma_attach_comp_func(struct ath_softc *sc)
+{
+
+ TASK_INIT(&sc->sc_txtask, 0, ath_edma_tx_proc, sc);
+}
+
void
ath_xmit_setup_edma(struct ath_softc *sc)
{
@@ -273,7 +302,10 @@ 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_attach_comp_func = ath_edma_attach_comp_func;
sc->sc_tx.xmit_dma_restart = ath_edma_dma_restart;
sc->sc_tx.xmit_handoff = ath_edma_xmit_handoff;
+ sc->sc_tx.xmit_processq = ath_edma_tx_processq;
+ sc->sc_tx.xmit_drainq = ath_edma_tx_draintxq;
}
diff --git a/sys/dev/ath/if_athvar.h b/sys/dev/ath/if_athvar.h
index 3c89e08..b742ad8 100644
--- a/sys/dev/ath/if_athvar.h
+++ b/sys/dev/ath/if_athvar.h
@@ -408,6 +408,17 @@ struct ath_tx_edma_fifo {
struct ath_tx_methods {
int (*xmit_setup)(struct ath_softc *sc);
int (*xmit_teardown)(struct ath_softc *sc);
+ void (*xmit_attach_comp_func)(struct ath_softc *sc);
+
+ void (*xmit_dma_restart)(struct ath_softc *sc,
+ struct ath_txq *txq);
+ void (*xmit_handoff)(struct ath_softc *sc,
+ struct ath_txq *txq, struct ath_buf *bf);
+
+ void (*xmit_drainq)(struct ath_softc *sc,
+ struct ath_txq *txq);
+ int (*xmit_processq)(struct ath_softc *sc,
+ struct ath_txq *txq, int dosched);
};
struct ath_softc {
OpenPOWER on IntegriCloud