FreeBSD/sys/dev/e1000/if_igb.c
/*********************************************************************
 *
 *  Free transmit ring related data structures.
 *
 **********************************************************************/
Free transmit ring related data structures.
Free transmit ring related data structures .
static void
igb_free_transmit_buffers(struct tx_ring *txr)
{
	struct adapter *adapter = txr->adapter;
	struct igb_tx_buf *tx_buffer;
	int             i;
	INIT_DEBUGOUT("free_transmit_ring: begin");
	if (txr->tx_buffers == NULL)
		return;
	tx_buffer = txr->tx_buffers;
	for (i = 0; i < adapter->num_tx_desc; i++, tx_buffer++) {
		if (tx_buffer->m_head != NULL) {
			bus_dmamap_sync(txr->txtag, tx_buffer->map,
			    BUS_DMASYNC_POSTWRITE);
			bus_dmamap_unload(txr->txtag,
			    tx_buffer->map);
			m_freem(tx_buffer->m_head);
			tx_buffer->m_head = NULL;
			if (tx_buffer->map != NULL) {
				bus_dmamap_destroy(txr->txtag,
				    tx_buffer->map);
				tx_buffer->map = NULL;
			}
		} else if (tx_buffer->map != NULL) {
			bus_dmamap_unload(txr->txtag,
			    tx_buffer->map);
			bus_dmamap_destroy(txr->txtag,
			    tx_buffer->map);
			tx_buffer->map = NULL;
		}
	}
#ifndef IGB_LEGACY_TX
	if (txr->br != NULL)
		buf_ring_free(txr->br, M_DEVBUF);
#endif
	if (txr->tx_buffers != NULL) {
		free(txr->tx_buffers, M_DEVBUF);
		txr->tx_buffers = NULL;
	}
	if (txr->txtag != NULL) {
		bus_dma_tag_destroy(txr->txtag);
		txr->txtag = NULL;
	}
	return;
}
static void igb_free_transmit_buffers ( struct tx_ring * txr ) { struct adapter * adapter = txr -> adapter ; struct igb_tx_buf * tx_buffer ; int i ; INIT_DEBUGOUT ( " " ) ; if ( txr -> tx_buffers == NULL ) return ; tx_buffer = txr -> tx_buffers ; for ( i = 0 ; i < adapter -> num_tx_desc ; i ++ , tx_buffer ++ ) { if ( tx_buffer -> m_head != NULL ) { bus_dmamap_sync ( txr -> txtag , tx_buffer -> map , BUS_DMASYNC_POSTWRITE ) ; bus_dmamap_unload ( txr -> txtag , tx_buffer -> map ) ; m_freem ( tx_buffer -> m_head ) ; tx_buffer -> m_head = NULL ; if ( tx_buffer -> map != NULL ) { bus_dmamap_destroy ( txr -> txtag , tx_buffer -> map ) ; tx_buffer -> map = NULL ; } } else if ( tx_buffer -> map != NULL ) { bus_dmamap_unload ( txr -> txtag , tx_buffer -> map ) ; bus_dmamap_destroy ( txr -> txtag , tx_buffer -> map ) ; tx_buffer -> map = NULL ; } } #ifndef IGB_LEGACY_TX if ( txr -> br != NULL ) buf_ring_free ( txr -> br , M_DEVBUF ) ; #endif if ( txr -> tx_buffers != NULL ) { free ( txr -> tx_buffers , M_DEVBUF ) ; txr -> tx_buffers = NULL ; } if ( txr -> txtag != NULL ) { bus_dma_tag_destroy ( txr -> txtag ) ; txr -> txtag = NULL ; } return ; }
Free transmit ring related data structures.
Free transmit ring related data structures .