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.
This commit is contained in:
adrian 2012-11-16 19:57:16 +00:00
parent f8cb5a0056
commit 7a03853cc3
4 changed files with 68 additions and 2 deletions

View File

@ -296,6 +296,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
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_softc *sc)
*/
#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, struct ath_txq *txq, int dosched)
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,

View File

@ -895,6 +895,13 @@ ath_rx_proc(struct ath_softc *sc, int resched)
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 *sc)
{
/* 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;

View File

@ -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 *sc, struct ath_txq *txq,
{
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 *sc)
* 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;

View File

@ -130,6 +130,13 @@ extern void ath_tx_node_sleep(struct ath_softc *sc, struct ath_node *an);
extern void ath_tx_node_wakeup(struct ath_softc *sc, struct ath_node *an);
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
*/