svn commit: r248999 - head/sys/dev/ath
Adrian Chadd
adrian at FreeBSD.org
Tue Apr 2 06:24:23 UTC 2013
Author: adrian
Date: Tue Apr 2 06:24:22 2013
New Revision: 248999
URL: http://svnweb.freebsd.org/changeset/base/248999
Log:
Some TX dmamap cleanups.
* Don't use BUS_DMA_ALLOCNOW for descriptor DMA maps; we never use
bounce buffers for the descriptors themselves.
* Add some XXX's to mark where the ath_buf has its mbuf ripped from
underneath it without actually cleaning up the dmamap. I haven't
audited those particular code paths to see if the DMA map is guaranteed
to be setup there; I'll do that later.
* Print out a warning if the descdma tidyup code is given some descriptors
w/ maps to free. Ideally the owner will free the mbufs and unmap
the descriptors before freeing the descriptor/ath_buf pairs, but
right now that's not guaranteed to be done.
Reviewed by: scottl (BUS_DMA_ALLOCNOW tag)
Modified:
head/sys/dev/ath/if_ath.c
Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c Tue Apr 2 06:21:37 2013 (r248998)
+++ head/sys/dev/ath/if_ath.c Tue Apr 2 06:24:22 2013 (r248999)
@@ -2742,6 +2742,7 @@ ath_start(struct ifnet *ifp)
"%s: flush fragmented packet, state %s\n",
__func__,
ieee80211_state_name[ni->ni_vap->iv_state]);
+ /* XXX dmamap */
ath_freetx(next);
goto reclaim;
}
@@ -3031,6 +3032,9 @@ ath_descdma_alloc_desc(struct ath_softc
/*
* Setup DMA descriptor area.
+ *
+ * BUS_DMA_ALLOCNOW is not used; we never use bounce
+ * buffers for the descriptors themselves.
*/
error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), /* parent */
PAGE_SIZE, 0, /* alignment, bounds */
@@ -3040,7 +3044,7 @@ ath_descdma_alloc_desc(struct ath_softc
dd->dd_desc_len, /* maxsize */
1, /* nsegments */
dd->dd_desc_len, /* maxsegsize */
- BUS_DMA_ALLOCNOW, /* flags */
+ 0, /* flags */
NULL, /* lockfunc */
NULL, /* lockarg */
&dd->dd_dmat);
@@ -3237,6 +3241,7 @@ ath_descdma_cleanup(struct ath_softc *sc
{
struct ath_buf *bf;
struct ieee80211_node *ni;
+ int do_warning = 0;
if (dd->dd_dmamap != 0) {
bus_dmamap_unload(dd->dd_dmat, dd->dd_dmamap);
@@ -3247,6 +3252,23 @@ ath_descdma_cleanup(struct ath_softc *sc
if (head != NULL) {
TAILQ_FOREACH(bf, head, bf_list) {
if (bf->bf_m) {
+ /*
+ * XXX warn if there's buffers here.
+ * XXX it should have been freed by the
+ * owner!
+ */
+
+ if (do_warning == 0) {
+ do_warning = 1;
+ device_printf(sc->sc_dev,
+ "%s: %s: mbuf should've been"
+ " unmapped/freed!\n",
+ __func__,
+ dd->dd_name);
+ }
+ bus_dmamap_sync(sc->sc_dmat, bf->bf_dmamap,
+ BUS_DMASYNC_POSTREAD);
+ bus_dmamap_unload(sc->sc_dmat, bf->bf_dmamap);
m_freem(bf->bf_m);
bf->bf_m = NULL;
}
More information about the svn-src-head
mailing list