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

Adrian Chadd adrian at FreeBSD.org
Fri Nov 16 19:57:17 UTC 2012


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)			\


More information about the svn-src-head mailing list