diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2006-02-11 09:40:37 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2006-02-11 09:40:37 +0000 |
commit | 2ea6b287eea20d2f1ea0cebed1ad2b78c96a546b (patch) | |
tree | 564011791e4d4824dfe6ce9c1a2161bdbc947d26 /sys | |
parent | 535cd8ef24c2eefe599adf46325b92b3327a795d (diff) |
fix nfe_free_tx_ring() and nfe_reset_tx_ring() to unmap the good items.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/if_nfe.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/sys/dev/pci/if_nfe.c b/sys/dev/pci/if_nfe.c index c752c65afd4..e88808a7441 100644 --- a/sys/dev/pci/if_nfe.c +++ b/sys/dev/pci/if_nfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nfe.c,v 1.26 2006/02/11 09:26:15 damien Exp $ */ +/* $OpenBSD: if_nfe.c,v 1.27 2006/02/11 09:40:36 damien Exp $ */ /*- * Copyright (c) 2006 Damien Bergamini <damien.bergamini@free.fr> @@ -1323,9 +1323,9 @@ nfe_reset_tx_ring(struct nfe_softc *sc, struct nfe_tx_ring *ring) data = &ring->data[i]; if (data->m != NULL) { - bus_dmamap_sync(sc->sc_dmat, data->map, 0, - data->map->dm_mapsize, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->sc_dmat, data->map); + bus_dmamap_sync(sc->sc_dmat, data->active, 0, + data->active->dm_mapsize, BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->sc_dmat, data->active); m_freem(data->m); data->m = NULL; } @@ -1366,15 +1366,20 @@ nfe_free_tx_ring(struct nfe_softc *sc, struct nfe_tx_ring *ring) data = &ring->data[i]; if (data->m != NULL) { - bus_dmamap_sync(sc->sc_dmat, data->map, 0, - data->map->dm_mapsize, + bus_dmamap_sync(sc->sc_dmat, data->active, 0, + data->active->dm_mapsize, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->sc_dmat, data->map); + bus_dmamap_unload(sc->sc_dmat, data->active); m_freem(data->m); } + } - if (data->map != NULL) - bus_dmamap_destroy(sc->sc_dmat, data->map); + /* ..and now actually destroy the DMA mappings */ + for (i = 0; i < NFE_TX_RING_COUNT; i++) { + data = &ring->data[i]; + if (data->map == NULL) + continue; + bus_dmamap_destroy(sc->sc_dmat, data->map); } } |