diff options
| author | jdolecek <jdolecek@NetBSD.org> | 2020-07-14 10:26:34 +0000 |
|---|---|---|
| committer | jdolecek <jdolecek@NetBSD.org> | 2020-07-14 10:26:34 +0000 |
| commit | 91b5ffa0912de9d713a2014c61eb0c120cc3c72e (patch) | |
| tree | c6f5709d8c3489805d19a2de0051c9811d0f22f3 /sys/dev | |
| parent | 373bf8f2e373609844be41007891e497f4f44f9b (diff) | |
only destroy the TX pkgs and dmamaps in bnx_dma_free() called on detach, don't
do it anymore in bnx_free_tx_chain(), called from bnx_init()
avoid occassional panic triggered by the free code having to allocate
memory from interrupt context when bnx_init() is called from bnx_watchdog()
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/pci/if_bnx.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c index e1cb48e1c3a..f60646d2c31 100644 --- a/sys/dev/pci/if_bnx.c +++ b/sys/dev/pci/if_bnx.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_bnx.c,v 1.96 2020/07/12 19:05:32 jdolecek Exp $ */ +/* $NetBSD: if_bnx.c,v 1.97 2020/07/14 10:26:34 jdolecek Exp $ */ /* $OpenBSD: if_bnx.c,v 1.101 2013/03/28 17:21:44 brad Exp $ */ /*- @@ -35,7 +35,7 @@ #if 0 __FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $"); #endif -__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.96 2020/07/12 19:05:32 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.97 2020/07/14 10:26:34 jdolecek Exp $"); /* * The following controllers are supported by this driver: @@ -2375,7 +2375,14 @@ bnx_dma_free(struct bnx_softc *sc) } /* Destroy the TX dmamaps. */ - /* This isn't necessary since we dont allocate them up front */ + struct bnx_pkt *pkt; + while ((pkt = TAILQ_FIRST(&sc->tx_free_pkts)) != NULL) { + TAILQ_REMOVE(&sc->tx_free_pkts, pkt, pkt_entry); + sc->tx_pkt_count--; + + bus_dmamap_destroy(sc->bnx_dmatag, pkt->pkt_dmamap); + pool_put(bnx_tx_pool, pkt); + } /* Free, unmap and destroy all RX buffer descriptor chain pages. */ for (i = 0; i < RX_PAGES; i++ ) { @@ -4245,22 +4252,8 @@ bnx_free_tx_chain(struct bnx_softc *sc) mutex_enter(&sc->tx_pkt_mtx); TAILQ_INSERT_TAIL(&sc->tx_free_pkts, pkt, pkt_entry); } - - /* Destroy all the dmamaps we allocated for TX */ - while ((pkt = TAILQ_FIRST(&sc->tx_free_pkts)) != NULL) { - TAILQ_REMOVE(&sc->tx_free_pkts, pkt, pkt_entry); - sc->tx_pkt_count--; - mutex_exit(&sc->tx_pkt_mtx); - - bus_dmamap_destroy(sc->bnx_dmatag, pkt->pkt_dmamap); - pool_put(bnx_tx_pool, pkt); - - mutex_enter(&sc->tx_pkt_mtx); - } mutex_exit(&sc->tx_pkt_mtx); - - /* Clear each TX chain page. */ for (i = 0; i < TX_PAGES; i++) { memset(sc->tx_bd_chain[i], 0, BNX_TX_CHAIN_PAGE_SZ); |
