svn commit: r238931 - head/sys/dev/ath

Adrian Chadd adrian at FreeBSD.org
Tue Jul 31 03:09:50 UTC 2012


Author: adrian
Date: Tue Jul 31 03:09:48 2012
New Revision: 238931
URL: http://svn.freebsd.org/changeset/base/238931

Log:
  Migrate some more TX side setup routines to be methods.

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_misc.h
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/ath/if_ath_tx.h
  head/sys/dev/ath/if_ath_tx_edma.c
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c	Tue Jul 31 02:28:32 2012	(r238930)
+++ head/sys/dev/ath/if_ath.c	Tue Jul 31 03:09:48 2012	(r238931)
@@ -254,6 +254,28 @@ SYSCTL_INT(_hw_ath, OID_AUTO, bstuck, CT
 
 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_s
 	}
 
 	/*
-	 * 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, str
 }
 
 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;

Modified: head/sys/dev/ath/if_ath_misc.h
==============================================================================
--- head/sys/dev/ath/if_ath_misc.h	Tue Jul 31 02:28:32 2012	(r238930)
+++ head/sys/dev/ath/if_ath_misc.h	Tue Jul 31 03:09:48 2012	(r238931)
@@ -66,7 +66,6 @@ extern void ath_returnbuf_head(struct at
 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(str
 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

Modified: head/sys/dev/ath/if_ath_tx.c
==============================================================================
--- head/sys/dev/ath/if_ath_tx.c	Tue Jul 31 02:28:32 2012	(r238930)
+++ head/sys/dev/ath/if_ath_tx.c	Tue Jul 31 03:09:48 2012	(r238931)
@@ -4494,7 +4494,10 @@ ath_xmit_setup_legacy(struct ath_softc *
 
 	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;
 }

Modified: head/sys/dev/ath/if_ath_tx.h
==============================================================================
--- head/sys/dev/ath/if_ath_tx.h	Tue Jul 31 02:28:32 2012	(r238930)
+++ head/sys/dev/ath/if_ath_tx.h	Tue Jul 31 03:09:48 2012	(r238931)
@@ -134,6 +134,11 @@ extern	void ath_addba_response_timeout(s
 	(_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

Modified: head/sys/dev/ath/if_ath_tx_edma.c
==============================================================================
--- head/sys/dev/ath/if_ath_tx_edma.c	Tue Jul 31 02:28:32 2012	(r238930)
+++ head/sys/dev/ath/if_ath_tx_edma.c	Tue Jul 31 03:09:48 2012	(r238931)
@@ -255,6 +255,35 @@ ath_edma_dma_txteardown(struct ath_softc
 	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;
 }

Modified: head/sys/dev/ath/if_athvar.h
==============================================================================
--- head/sys/dev/ath/if_athvar.h	Tue Jul 31 02:28:32 2012	(r238930)
+++ head/sys/dev/ath/if_athvar.h	Tue Jul 31 03:09:48 2012	(r238931)
@@ -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 {


More information about the svn-src-all mailing list