diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2011-02-22 20:05:04 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2011-02-22 20:05:04 +0000 |
commit | 0e07a707693c7393ccc9cb567b03c709abcbf521 (patch) | |
tree | 55386f32a47e3e946c7a331b611e276b43716185 /sys/dev/ic/rt2661.c | |
parent | d6dd3231dee22e98623ee76416f865de491393af (diff) |
Mark descriptors as invalid *before* unmapping the associated mbuf.
Might prevent the unrecoverable DMA error mentioned in PR 6557.
ok damien@
Diffstat (limited to 'sys/dev/ic/rt2661.c')
-rw-r--r-- | sys/dev/ic/rt2661.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/dev/ic/rt2661.c b/sys/dev/ic/rt2661.c index d329378621e..d8922894ca3 100644 --- a/sys/dev/ic/rt2661.c +++ b/sys/dev/ic/rt2661.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rt2661.c,v 1.63 2010/09/07 16:21:42 deraadt Exp $ */ +/* $OpenBSD: rt2661.c,v 1.64 2011/02/22 20:05:03 kettenis Exp $ */ /*- * Copyright (c) 2006 @@ -1004,13 +1004,6 @@ rt2661_tx_dma_intr(struct rt2661_softc *sc, struct rt2661_tx_ring *txq) !(letoh32(desc->flags) & RT2661_TX_VALID)) break; - bus_dmamap_sync(sc->sc_dmat, data->map, 0, - data->map->dm_mapsize, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->sc_dmat, data->map); - m_freem(data->m); - data->m = NULL; - /* node reference is released in rt2661_tx_intr() */ - /* descriptor is no longer valid */ desc->flags &= ~htole32(RT2661_TX_VALID); @@ -1018,6 +1011,13 @@ rt2661_tx_dma_intr(struct rt2661_softc *sc, struct rt2661_tx_ring *txq) txq->next * RT2661_TX_DESC_SIZE, RT2661_TX_DESC_SIZE, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->sc_dmat, data->map, 0, + data->map->dm_mapsize, BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->sc_dmat, data->map); + m_freem(data->m); + data->m = NULL; + /* node reference is released in rt2661_tx_intr() */ + DPRINTFN(15, ("tx dma done q=%p idx=%u\n", txq, txq->next)); if (++txq->next >= txq->count) /* faster than % count */ |