diff options
| author | thorpej <thorpej@NetBSD.org> | 2001-06-30 05:48:24 +0000 |
|---|---|---|
| committer | thorpej <thorpej@NetBSD.org> | 2001-06-30 05:48:24 +0000 |
| commit | 6237e487ab8e1fcd6953882400a709ab9c62ad00 (patch) | |
| tree | acf7269302263425cd81e454205ec887013b0bbc /sys/dev | |
| parent | 17238bfd2bb344c87b227a19dec890be056a2f74 (diff) | |
When a transmit is complete, sync (and unload!!) the DMA map used
for the packet. When setting up a packet for transmit, sync the
DMA map being used.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/pci/if_ti.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/sys/dev/pci/if_ti.c b/sys/dev/pci/if_ti.c index 07230b1c6f0..73c138dd33c 100644 --- a/sys/dev/pci/if_ti.c +++ b/sys/dev/pci/if_ti.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ti.c,v 1.28 2001/06/30 04:33:11 thorpej Exp $ */ +/* $NetBSD: if_ti.c,v 1.29 2001/06/30 05:48:24 thorpej Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -2084,6 +2084,7 @@ static void ti_txeof(sc) { struct ti_tx_desc *cur_tx = NULL; struct ifnet *ifp; + struct txdmamap_pool_entry *dma; ifp = &sc->ethercom.ec_if; @@ -2117,10 +2118,14 @@ static void ti_txeof(sc) m_freem(sc->ti_cdata.ti_tx_chain[idx]); sc->ti_cdata.ti_tx_chain[idx] = NULL; - /* if (sc->txdma[idx] == 0) panic() */ - SIMPLEQ_INSERT_HEAD(&sc->txdma_list, sc->txdma[idx], - link); - sc->txdma[idx] = 0; + dma = sc->txdma[idx]; + KDASSERT(dma != NULL); + bus_dmamap_sync(sc->sc_dmat, dma->dmamap, 0, + dma->dmamap->dm_mapsize, BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->sc_dmat, dma->dmamap); + + SIMPLEQ_INSERT_HEAD(&sc->txdma_list, dma, link); + sc->txdma[idx] = NULL; } sc->ti_txcnt--; TI_INC(sc->ti_tx_saved_considx, TI_TX_RING_CNT); @@ -2290,6 +2295,11 @@ static int ti_encap(sc, m_head, txidx) TI_BDFLAG_END; else sc->ti_rdata->ti_tx_ring[cur].ti_flags |= TI_BDFLAG_END; + + /* Sync the packet's DMA map. */ + bus_dmamap_sync(sc->sc_dmat, dmamap, 0, dmamap->dm_mapsize, + BUS_DMASYNC_PREWRITE); + sc->ti_cdata.ti_tx_chain[cur] = m_head; SIMPLEQ_REMOVE_HEAD(&sc->txdma_list, dma, link); sc->txdma[cur] = dma; |
