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

Adrian Chadd adrian at FreeBSD.org
Mon Apr 1 20:12:22 UTC 2013


Author: adrian
Date: Mon Apr  1 20:12:21 2013
New Revision: 248985
URL: http://svnweb.freebsd.org/changeset/base/248985

Log:
  Use ATH_MAX_SCATTER rather than ATH_TXDESC.
  
  ATH_MAX_SCATTER is used to size the ath_buf DMA segment array.
  We thus should use it when checking sizes of things.

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_tx.c

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c	Mon Apr  1 20:11:19 2013	(r248984)
+++ head/sys/dev/ath/if_ath.c	Mon Apr  1 20:12:21 2013	(r248985)
@@ -3276,7 +3276,7 @@ ath_desc_alloc(struct ath_softc *sc)
 	int error;
 
 	error = ath_descdma_setup(sc, &sc->sc_txdma, &sc->sc_txbuf,
-		    "tx", sc->sc_tx_desclen, ath_txbuf, ATH_TXDESC);
+		    "tx", sc->sc_tx_desclen, ath_txbuf, ATH_MAX_SCATTER);
 	if (error != 0) {
 		return error;
 	}

Modified: head/sys/dev/ath/if_ath_tx.c
==============================================================================
--- head/sys/dev/ath/if_ath_tx.c	Mon Apr  1 20:11:19 2013	(r248984)
+++ head/sys/dev/ath/if_ath_tx.c	Mon Apr  1 20:12:21 2013	(r248985)
@@ -312,7 +312,7 @@ ath_tx_dmasetup(struct ath_softc *sc, st
 				     BUS_DMA_NOWAIT);
 	if (error == EFBIG) {
 		/* XXX packet requires too many descriptors */
-		bf->bf_nseg = ATH_TXDESC+1;
+		bf->bf_nseg = ATH_MAX_SCATTER + 1;
 	} else if (error != 0) {
 		sc->sc_stats.ast_tx_busdma++;
 		ath_freetx(m0);
@@ -323,9 +323,9 @@ ath_tx_dmasetup(struct ath_softc *sc, st
 	 * require too many TX descriptors.  We try to convert
 	 * the latter to a cluster.
 	 */
-	if (bf->bf_nseg > ATH_TXDESC) {		/* too many desc's, linearize */
+	if (bf->bf_nseg > ATH_MAX_SCATTER) {		/* too many desc's, linearize */
 		sc->sc_stats.ast_tx_linear++;
-		m = m_collapse(m0, M_NOWAIT, ATH_TXDESC);
+		m = m_collapse(m0, M_NOWAIT, ATH_MAX_SCATTER);
 		if (m == NULL) {
 			ath_freetx(m0);
 			sc->sc_stats.ast_tx_nombuf++;
@@ -340,7 +340,7 @@ ath_tx_dmasetup(struct ath_softc *sc, st
 			ath_freetx(m0);
 			return error;
 		}
-		KASSERT(bf->bf_nseg <= ATH_TXDESC,
+		KASSERT(bf->bf_nseg <= ATH_MAX_SCATTER,
 		    ("too many segments after defrag; nseg %u", bf->bf_nseg));
 	} else if (bf->bf_nseg == 0) {		/* null packet, discard */
 		sc->sc_stats.ast_tx_nodata++;


More information about the svn-src-head mailing list