From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 03:09:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1339B106564A; Tue, 31 Jul 2012 03:09:50 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F09118FC0A; Tue, 31 Jul 2012 03:09:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6V39nZl078835; Tue, 31 Jul 2012 03:09:49 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6V39ngx078828; Tue, 31 Jul 2012 03:09:49 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207310309.q6V39ngx078828@svn.freebsd.org> From: Adrian Chadd Date: Tue, 31 Jul 2012 03:09:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238931 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jul 2012 03:09:50 -0000 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_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_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 {