summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2009-04-20 11:39:03 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2009-04-20 11:39:03 +0000
commit23e598a51d0e73f4f53294ae75c7b8b0624f85ff (patch)
treec49f01a5b8c5a225fcf9ad20f7655bde268bf2a1 /sys/dev/pci
parent4244758b30dcad184aac3878ed35f88804bb0e64 (diff)
fix dma map unmapping and unloading in the tx cleanup path.
ok dlg@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_bnx.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c
index 914f9e6305d..97482570d2a 100644
--- a/sys/dev/pci/if_bnx.c
+++ b/sys/dev/pci/if_bnx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bnx.c,v 1.74 2009/04/14 07:41:24 kettenis Exp $ */
+/* $OpenBSD: if_bnx.c,v 1.75 2009/04/20 11:39:02 reyk Exp $ */
/*-
* Copyright (c) 2006 Broadcom Corporation
@@ -3451,11 +3451,14 @@ bnx_free_tx_chain(struct bnx_softc *sc)
/* Unmap, unload, and free any mbufs still in the TX mbuf chain. */
for (i = 0; i < TOTAL_TX_BD; i++) {
if (sc->tx_mbuf_ptr[i] != NULL) {
- if (sc->tx_mbuf_map != NULL)
+ if (sc->tx_mbuf_map[i] != NULL) {
bus_dmamap_sync(sc->bnx_dmatag,
sc->tx_mbuf_map[i], 0,
sc->tx_mbuf_map[i]->dm_mapsize,
BUS_DMASYNC_POSTWRITE);
+ bus_dmamap_unload(sc->bnx_dmatag,
+ sc->tx_mbuf_map[i]);
+ }
m_freem(sc->tx_mbuf_ptr[i]);
sc->tx_mbuf_ptr[i] = NULL;
DBRUNIF(1, sc->tx_mbuf_alloc--);
@@ -3623,11 +3626,14 @@ bnx_free_rx_chain(struct bnx_softc *sc)
/* Free any mbufs still in the RX mbuf chain. */
for (i = 0; i < TOTAL_RX_BD; i++) {
if (sc->rx_mbuf_ptr[i] != NULL) {
- if (sc->rx_mbuf_map[i] != NULL)
+ if (sc->rx_mbuf_map[i] != NULL) {
bus_dmamap_sync(sc->bnx_dmatag,
sc->rx_mbuf_map[i], 0,
sc->rx_mbuf_map[i]->dm_mapsize,
BUS_DMASYNC_POSTREAD);
+ bus_dmamap_unload(sc->bnx_dmatag,
+ sc->rx_mbuf_map[i]);
+ }
m_freem(sc->rx_mbuf_ptr[i]);
sc->rx_mbuf_ptr[i] = NULL;
DBRUNIF(1, sc->rx_mbuf_alloc--);