From owner-svn-src-all@FreeBSD.ORG Fri Nov 16 19:57:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BC1BF299; Fri, 16 Nov 2012 19:57:16 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 90CBE8FC0C; Fri, 16 Nov 2012 19:57:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAGJvGXI053089; Fri, 16 Nov 2012 19:57:16 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAGJvGEk053083; Fri, 16 Nov 2012 19:57:16 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201211161957.qAGJvGEk053083@svn.freebsd.org> From: Adrian Chadd Date: Fri, 16 Nov 2012 19:57:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243162 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Nov 2012 19:57:17 -0000 Author: adrian Date: Fri Nov 16 19:57:16 2012 New Revision: 243162 URL: http://svnweb.freebsd.org/changeset/base/243162 Log: ALQ logging enhancements: * upon setup, tell the alq code what the chip information is. * add TX/RX path logging for legacy chips. * populate the tx/rx descriptor length fields with a best-estimate. It's overly big (96 bytes when AH_SUPPORT_AR5416 is enabled) but it'll do for now. Whilst I'm here, add CURVNET_RESTORE() here during probe/attach as a partial solution to fixing crashes during attach when the attach fails. There are other attach failures that I have to deal with; those'll come later. Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_rx.c head/sys/dev/ath/if_ath_tx.c head/sys/dev/ath/if_ath_tx.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Fri Nov 16 19:55:58 2012 (r243161) +++ head/sys/dev/ath/if_ath.c Fri Nov 16 19:57:16 2012 (r243162) @@ -296,6 +296,7 @@ ath_attach(u_int16_t devid, struct ath_s if (ifp == NULL) { device_printf(sc->sc_dev, "can not if_alloc()\n"); error = ENOSPC; + CURVNET_RESTORE(); goto bad; } ic = ifp->if_l2com; @@ -890,6 +891,11 @@ ath_attach(u_int16_t devid, struct ath_s */ #ifdef ATH_DEBUG_ALQ if_ath_alq_init(&sc->sc_alq, device_get_nameunit(sc->sc_dev)); + if_ath_alq_setcfg(&sc->sc_alq, + sc->sc_ah->ah_macVersion, + sc->sc_ah->ah_macRev, + sc->sc_ah->ah_phyRev, + sc->sc_ah->ah_magic); #endif /* @@ -3768,6 +3774,14 @@ ath_tx_processq(struct ath_softc *sc, st ath_printtxbuf(sc, bf, txq->axq_qnum, 0, status == HAL_OK); #endif +#ifdef ATH_DEBUG_ALQ + if (if_ath_alq_checkdebug(&sc->sc_alq, + ATH_ALQ_EDMA_TXSTATUS)) { + if_ath_alq_post(&sc->sc_alq, ATH_ALQ_EDMA_TXSTATUS, + sc->sc_tx_statuslen, + (char *) ds); + } +#endif if (status == HAL_EINPROGRESS) { ATH_KTR(sc, ATH_KTR_TXCOMP, 3, Modified: head/sys/dev/ath/if_ath_rx.c ============================================================================== --- head/sys/dev/ath/if_ath_rx.c Fri Nov 16 19:55:58 2012 (r243161) +++ head/sys/dev/ath/if_ath_rx.c Fri Nov 16 19:57:16 2012 (r243162) @@ -895,6 +895,13 @@ ath_rx_proc(struct ath_softc *sc, int re if (sc->sc_debug & ATH_DEBUG_RECV_DESC) ath_printrxbuf(sc, bf, 0, status == HAL_OK); #endif + +#ifdef ATH_DEBUG_ALQ + if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_EDMA_RXSTATUS)) + if_ath_alq_post(&sc->sc_alq, ATH_ALQ_EDMA_RXSTATUS, + sc->sc_rx_statuslen, (char *) ds); +#endif /* ATH_DEBUG_ALQ */ + if (status == HAL_EINPROGRESS) break; @@ -1120,7 +1127,11 @@ ath_recv_setup_legacy(struct ath_softc * { /* Sensible legacy defaults */ - sc->sc_rx_statuslen = 0; + /* + * XXX this should be changed to properly support the + * exact RX descriptor size for each HAL. + */ + sc->sc_rx_statuslen = sizeof(struct ath_desc); sc->sc_rx.recv_start = ath_legacy_startrecv; sc->sc_rx.recv_stop = ath_legacy_stoprecv; Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Fri Nov 16 19:55:58 2012 (r243161) +++ head/sys/dev/ath/if_ath_tx.c Fri Nov 16 19:57:16 2012 (r243162) @@ -130,6 +130,35 @@ static struct ath_buf * ath_tx_retry_clone(struct ath_softc *sc, struct ath_node *an, struct ath_tid *tid, struct ath_buf *bf); +#ifdef ATH_DEBUG_ALQ +void +ath_tx_alq_post(struct ath_softc *sc, struct ath_buf *bf_first) +{ + struct ath_buf *bf; + int i, n; + const char *ds; + + /* XXX we should skip out early if debugging isn't enabled! */ + bf = bf_first; + + while (bf != NULL) { + /* XXX should ensure bf_nseg > 0! */ + if (bf->bf_nseg == 0) + break; + n = ((bf->bf_nseg - 1) / sc->sc_tx_nmaps) + 1; + for (i = 0, ds = (const char *) bf->bf_desc; + i < n; + i++, ds += sc->sc_tx_desclen) { + if_ath_alq_post(&sc->sc_alq, + ATH_ALQ_EDMA_TXDESC, + sc->sc_tx_desclen, + ds); + } + bf = bf->bf_next; + } +} +#endif /* ATH_DEBUG_ALQ */ + /* * Whether to use the 11n rate scenario functions or not */ @@ -913,6 +942,11 @@ ath_legacy_xmit_handoff(struct ath_softc { ATH_TXQ_LOCK_ASSERT(txq); +#ifdef ATH_DEBUG_ALQ + if (if_ath_alq_checkdebug(&sc->sc_alq, ATH_ALQ_EDMA_TXDESC)) + ath_tx_alq_post(sc, bf); +#endif + if (txq->axq_qnum == ATH_TXQ_SWQ) ath_tx_handoff_mcast(sc, txq, bf); else @@ -5490,7 +5524,7 @@ ath_xmit_setup_legacy(struct ath_softc * * worry about extracting the real length out of the HAL later. */ sc->sc_tx_desclen = sizeof(struct ath_desc); - sc->sc_tx_statuslen = 0; + sc->sc_tx_statuslen = sizeof(struct ath_desc); sc->sc_tx_nmaps = 1; /* only one buffer per TX desc */ sc->sc_tx.xmit_setup = ath_legacy_dma_txsetup; Modified: head/sys/dev/ath/if_ath_tx.h ============================================================================== --- head/sys/dev/ath/if_ath_tx.h Fri Nov 16 19:55:58 2012 (r243161) +++ head/sys/dev/ath/if_ath_tx.h Fri Nov 16 19:57:16 2012 (r243162) @@ -131,6 +131,13 @@ extern void ath_tx_node_wakeup(struct at extern int ath_tx_node_is_asleep(struct ath_softc *sc, struct ath_node *an); /* + * Misc debugging stuff + */ +#ifdef ATH_DEBUG_ALQ +extern void ath_tx_alq_post(struct ath_softc *sc, struct ath_buf *bf_first); +#endif /* ATH_DEBUG_ALQ */ + +/* * Setup path */ #define ath_txdma_setup(_sc) \