--- //depot/vendor/freebsd/src/sys/dev/bce/if_bce.c +++ //depot/user/jhb/cleanup/sys/dev/bce/if_bce.c @@ -3251,6 +3251,13 @@ DBENTER(BCE_VERBOSE_RESET | BCE_VERBOSE_UNLOAD | BCE_VERBOSE_CTX); /* Free, unmap, and destroy the status block. */ + if (sc->status_block_paddr != 0) { + bus_dmamap_unload( + sc->status_tag, + sc->status_map); + sc->status_block_paddr = 0; + } + if (sc->status_block != NULL) { bus_dmamem_free( sc->status_tag, @@ -3259,15 +3266,6 @@ sc->status_block = NULL; } - if (sc->status_map != NULL) { - bus_dmamap_unload( - sc->status_tag, - sc->status_map); - bus_dmamap_destroy(sc->status_tag, - sc->status_map); - sc->status_map = NULL; - } - if (sc->status_tag != NULL) { bus_dma_tag_destroy(sc->status_tag); sc->status_tag = NULL; @@ -3275,6 +3273,13 @@ /* Free, unmap, and destroy the statistics block. */ + if (sc->stats_block_paddr != 0) { + bus_dmamap_unload( + sc->stats_tag, + sc->stats_map); + sc->stats_block_paddr = 0; + } + if (sc->stats_block != NULL) { bus_dmamem_free( sc->stats_tag, @@ -3283,15 +3288,6 @@ sc->stats_block = NULL; } - if (sc->stats_map != NULL) { - bus_dmamap_unload( - sc->stats_tag, - sc->stats_map); - bus_dmamap_destroy(sc->stats_tag, - sc->stats_map); - sc->stats_map = NULL; - } - if (sc->stats_tag != NULL) { bus_dma_tag_destroy(sc->stats_tag); sc->stats_tag = NULL; @@ -3301,6 +3297,13 @@ /* Free, unmap and destroy all context memory pages. */ if (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) { for (i = 0; i < sc->ctx_pages; i++ ) { + if (sc->ctx_paddr[i] != 0) { + bus_dmamap_unload( + sc->ctx_tag, + sc->ctx_map[i]); + sc->ctx_paddr[i] = 0; + } + if (sc->ctx_block[i] != NULL) { bus_dmamem_free( sc->ctx_tag, @@ -3308,16 +3311,6 @@ sc->ctx_map[i]); sc->ctx_block[i] = NULL; } - - if (sc->ctx_map[i] != NULL) { - bus_dmamap_unload( - sc->ctx_tag, - sc->ctx_map[i]); - bus_dmamap_destroy( - sc->ctx_tag, - sc->ctx_map[i]); - sc->ctx_map[i] = NULL; - } } /* Destroy the context memory tag. */ @@ -3330,6 +3323,13 @@ /* Free, unmap and destroy all TX buffer descriptor chain pages. */ for (i = 0; i < sc->tx_pages; i++ ) { + if (sc->tx_bd_chain_paddr[i] != 0) { + bus_dmamap_unload( + sc->tx_bd_chain_tag, + sc->tx_bd_chain_map[i]); + sc->tx_bd_chain_paddr[i] = 0; + } + if (sc->tx_bd_chain[i] != NULL) { bus_dmamem_free( sc->tx_bd_chain_tag, @@ -3337,16 +3337,6 @@ sc->tx_bd_chain_map[i]); sc->tx_bd_chain[i] = NULL; } - - if (sc->tx_bd_chain_map[i] != NULL) { - bus_dmamap_unload( - sc->tx_bd_chain_tag, - sc->tx_bd_chain_map[i]); - bus_dmamap_destroy( - sc->tx_bd_chain_tag, - sc->tx_bd_chain_map[i]); - sc->tx_bd_chain_map[i] = NULL; - } } /* Destroy the TX buffer descriptor tag. */ @@ -3358,6 +3348,13 @@ /* Free, unmap and destroy all RX buffer descriptor chain pages. */ for (i = 0; i < sc->rx_pages; i++ ) { + if (sc->rx_bd_chain_paddr[i] != 0) { + bus_dmamap_unload( + sc->rx_bd_chain_tag, + sc->rx_bd_chain_map[i]); + sc->rx_bd_chain_paddr[i] = 0; + } + if (sc->rx_bd_chain[i] != NULL) { bus_dmamem_free( sc->rx_bd_chain_tag, @@ -3365,16 +3362,6 @@ sc->rx_bd_chain_map[i]); sc->rx_bd_chain[i] = NULL; } - - if (sc->rx_bd_chain_map[i] != NULL) { - bus_dmamap_unload( - sc->rx_bd_chain_tag, - sc->rx_bd_chain_map[i]); - bus_dmamap_destroy( - sc->rx_bd_chain_tag, - sc->rx_bd_chain_map[i]); - sc->rx_bd_chain_map[i] = NULL; - } } /* Destroy the RX buffer descriptor tag. */ @@ -3387,6 +3374,13 @@ /* Free, unmap and destroy all page buffer descriptor chain pages. */ if (bce_hdr_split == TRUE) { for (i = 0; i < sc->pg_pages; i++ ) { + if (sc->pg_bd_chain_paddr[i] != 0) { + bus_dmamap_unload( + sc->pg_bd_chain_tag, + sc->pg_bd_chain_map[i]); + sc->pg_bd_chain_paddr[i] = 0; + } + if (sc->pg_bd_chain[i] != NULL) { bus_dmamem_free( sc->pg_bd_chain_tag, @@ -3394,16 +3388,6 @@ sc->pg_bd_chain_map[i]); sc->pg_bd_chain[i] = NULL; } - - if (sc->pg_bd_chain_map[i] != NULL) { - bus_dmamap_unload( - sc->pg_bd_chain_tag, - sc->pg_bd_chain_map[i]); - bus_dmamap_destroy( - sc->pg_bd_chain_tag, - sc->pg_bd_chain_map[i]); - sc->pg_bd_chain_map[i] = NULL; - } } /* Destroy the page buffer descriptor tag. */ --- //depot/vendor/freebsd/src/sys/dev/qlxgb/qla_os.c +++ //depot/user/jhb/cleanup/sys/dev/qlxgb/qla_os.c @@ -602,6 +602,7 @@ void qla_free_dmabuf(qla_host_t *ha, qla_dma_t *dma_buf) { + bus_dmamap_unload(dma_buf->dma_tag, dma_buf->dma_map); bus_dmamem_free(dma_buf->dma_tag, dma_buf->dma_b, dma_buf->dma_map); bus_dma_tag_destroy(dma_buf->dma_tag); } --- //depot/vendor/freebsd/src/sys/dev/qlxgbe/ql_os.c +++ //depot/user/jhb/cleanup/sys/dev/qlxgbe/ql_os.c @@ -681,6 +681,7 @@ void ql_free_dmabuf(qla_host_t *ha, qla_dma_t *dma_buf) { + bus_dmamap_unload(dma_buf->dma_tag, dma_buf->dma_map); bus_dmamem_free(dma_buf->dma_tag, dma_buf->dma_b, dma_buf->dma_map); bus_dma_tag_destroy(dma_buf->dma_tag); } --- //depot/vendor/freebsd/src/sys/dev/qlxge/qls_os.c +++ //depot/user/jhb/cleanup/sys/dev/qlxge/qls_os.c @@ -670,6 +670,7 @@ void qls_free_dmabuf(qla_host_t *ha, qla_dma_t *dma_buf) { + bus_dmamap_unload(dma_buf->dma_tag, dma_buf->dma_map); bus_dmamem_free(dma_buf->dma_tag, dma_buf->dma_b, dma_buf->dma_map); bus_dma_tag_destroy(dma_buf->dma_tag); }