Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Jan 2005 19:59:26 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 69316 for review
Message-ID:  <200501191959.j0JJxQGx076713@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=69316

Change 69316 by sam@sam_ebb on 2005/01/19 19:58:26

	use bus_dmamap_load_mbuf_sg

Affected files ...

.. //depot/projects/wifi/sys/dev/ath/if_ath.c#70 edit

Differences ...

==== //depot/projects/wifi/sys/dev/ath/if_ath.c#70 (text+ko) ====

@@ -1987,18 +1987,6 @@
 		__func__, rfilt, mfilt[0], mfilt[1]);
 }
 
-static void
-ath_mbuf_load_cb(void *arg, bus_dma_segment_t *seg, int nseg, bus_size_t mapsize, int error)
-{
-	struct ath_buf *bf = arg;
-
-	KASSERT(nseg <= ATH_MAX_SCATTER, ("too many DMA segments %u", nseg));
-	KASSERT(error == 0, ("error %u on bus_dma callback", error));
-	bf->bf_mapsize = mapsize;
-	bf->bf_nseg = nseg;
-	bcopy(seg, bf->bf_segs, nseg * sizeof (seg[0]));
-}
-
 /*
  * Set the slot time based on the current setting.
  */
@@ -2081,8 +2069,8 @@
 		sc->sc_stats.ast_be_nombuf++;
 		return ENOMEM;
 	}
-	error = bus_dmamap_load_mbuf(sc->sc_dmat, bf->bf_dmamap, m,
-				     ath_mbuf_load_cb, bf,
+	error = bus_dmamap_load_mbuf_sg(sc->sc_dmat, bf->bf_dmamap, m,
+				     bf->bf_segs, &bf->bf_nseg,
 				     BUS_DMA_NOWAIT);
 	if (error == 0) {
 		bf->bf_m = m;
@@ -2227,12 +2215,12 @@
 	if (ieee80211_beacon_update(ic, bf->bf_node, &sc->sc_boff, m, ncabq)) {
 		/* XXX too conservative? */
 		bus_dmamap_unload(sc->sc_dmat, bf->bf_dmamap);
-		error = bus_dmamap_load_mbuf(sc->sc_dmat, bf->bf_dmamap, m,
-					     ath_mbuf_load_cb, bf,
+		error = bus_dmamap_load_mbuf_sg(sc->sc_dmat, bf->bf_dmamap, m,
+					     bf->bf_segs, &bf->bf_nseg,
 					     BUS_DMA_NOWAIT);
 		if (error != 0) {
 			if_printf(ic->ic_ifp,
-			    "%s: bus_dmamap_load_mbuf failed, error %u\n",
+			    "%s: bus_dmamap_load_mbuf_sg failed, error %u\n",
 			    __func__, error);
 			return;
 		}
@@ -2732,14 +2720,14 @@
 		bf->bf_m = m;
 		m->m_pkthdr.len = m->m_len = m->m_ext.ext_size;
 
-		error = bus_dmamap_load_mbuf(sc->sc_dmat,
+		error = bus_dmamap_load_mbuf_sg(sc->sc_dmat,
 					     bf->bf_dmamap, m,
-					     ath_mbuf_load_cb, bf,
+					     bf->bf_segs, &bf->bf_nseg,
 					     BUS_DMA_NOWAIT);
 		if (error != 0) {
 			DPRINTF(sc, ATH_DEBUG_ANY,
-				"%s: bus_dmamap_load_mbuf failed; error %d\n",
-				__func__, error);
+			    "%s: bus_dmamap_load_mbuf_sg failed; error %d\n",
+			    __func__, error);
 			sc->sc_stats.ast_rx_busdma++;
 			return error;
 		}
@@ -3383,8 +3371,8 @@
 	 * Load the DMA map so any coalescing is done.  This
 	 * also calculates the number of descriptors we need.
 	 */
-	error = bus_dmamap_load_mbuf(sc->sc_dmat, bf->bf_dmamap, m0,
-				     ath_mbuf_load_cb, bf,
+	error = bus_dmamap_load_mbuf_sg(sc->sc_dmat, bf->bf_dmamap, m0,
+				     bf->bf_segs, &bf->bf_nseg,
 				     BUS_DMA_NOWAIT);
 	if (error == EFBIG) {
 		/* XXX packet requires too many descriptors */
@@ -3407,8 +3395,8 @@
 			m_freem(m0);
 			return ENOMEM;
 		}
-		error = bus_dmamap_load_mbuf(sc->sc_dmat, bf->bf_dmamap, m0,
-					     ath_mbuf_load_cb, bf,
+		error = bus_dmamap_load_mbuf_sg(sc->sc_dmat, bf->bf_dmamap, m0,
+					     bf->bf_segs, &bf->bf_nseg,
 					     BUS_DMA_NOWAIT);
 		if (error != 0) {
 			sc->sc_stats.ast_tx_busdma++;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200501191959.j0JJxQGx076713>