FreeBSD/sys/dev/e1000/if_lem.c
/*********************************************************************
 *
 *  Free all transmit related data structures.
 *
 **********************************************************************/
Free all transmit related data structures.
Free all transmit related data structures .
static void
lem_free_transmit_structures(struct adapter *adapter)
{
	struct em_buffer *tx_buffer;
	INIT_DEBUGOUT("free_transmit_structures: begin");
	if (adapter->tx_buffer_area != NULL) {
		for (int i = 0; i < adapter->num_tx_desc; i++) {
			tx_buffer = &adapter->tx_buffer_area[i];
			if (tx_buffer->m_head != NULL) {
				bus_dmamap_sync(adapter->txtag, tx_buffer->map,
				    BUS_DMASYNC_POSTWRITE);
				bus_dmamap_unload(adapter->txtag,
				    tx_buffer->map);
				m_freem(tx_buffer->m_head);
				tx_buffer->m_head = NULL;
			} else if (tx_buffer->map != NULL)
				bus_dmamap_unload(adapter->txtag,
				    tx_buffer->map);
			if (tx_buffer->map != NULL) {
				bus_dmamap_destroy(adapter->txtag,
				    tx_buffer->map);
				tx_buffer->map = NULL;
			}
		}
	}
	if (adapter->tx_buffer_area != NULL) {
		free(adapter->tx_buffer_area, M_DEVBUF);
		adapter->tx_buffer_area = NULL;
	}
	if (adapter->txtag != NULL) {
		bus_dma_tag_destroy(adapter->txtag);
		adapter->txtag = NULL;
	}
}
static void lem_free_transmit_structures ( struct adapter * adapter ) { struct em_buffer * tx_buffer ; INIT_DEBUGOUT ( " " ) ; if ( adapter -> tx_buffer_area != NULL ) { for ( int i = 0 ; i < adapter -> num_tx_desc ; i ++ ) { tx_buffer = & adapter -> tx_buffer_area [ i ] ; if ( tx_buffer -> m_head != NULL ) { bus_dmamap_sync ( adapter -> txtag , tx_buffer -> map , BUS_DMASYNC_POSTWRITE ) ; bus_dmamap_unload ( adapter -> txtag , tx_buffer -> map ) ; m_freem ( tx_buffer -> m_head ) ; tx_buffer -> m_head = NULL ; } else if ( tx_buffer -> map != NULL ) bus_dmamap_unload ( adapter -> txtag , tx_buffer -> map ) ; if ( tx_buffer -> map != NULL ) { bus_dmamap_destroy ( adapter -> txtag , tx_buffer -> map ) ; tx_buffer -> map = NULL ; } } } if ( adapter -> tx_buffer_area != NULL ) { free ( adapter -> tx_buffer_area , M_DEVBUF ) ; adapter -> tx_buffer_area = NULL ; } if ( adapter -> txtag != NULL ) { bus_dma_tag_destroy ( adapter -> txtag ) ; adapter -> txtag = NULL ; } }
Free all transmit related data structures.
Free all transmit related data structures .