FreeBSD/sys/dev/ixl/ixl_txrx.c
/*********************************************************************
 *
 *  Free transmit ring related data structures.
 *
 **********************************************************************/
Free transmit ring related data structures.
Free transmit ring related data structures .
void
ixl_free_que_tx(struct ixl_queue *que)
{
	struct tx_ring *txr = &que->txr;
	struct ixl_tx_buf *buf;
	INIT_DBG_IF(que->vsi->ifp, "queue %d: begin", que->me);
	for (int i = 0; i < que->num_desc; i++) {
		buf = &txr->buffers[i];
		if (buf->m_head != NULL) {
			bus_dmamap_sync(buf->tag, buf->map,
			    BUS_DMASYNC_POSTWRITE);
			bus_dmamap_unload(buf->tag,
			    buf->map);
			m_freem(buf->m_head);
			buf->m_head = NULL;
			if (buf->map != NULL) {
				bus_dmamap_destroy(buf->tag,
				    buf->map);
				buf->map = NULL;
			}
		} else if (buf->map != NULL) {
			bus_dmamap_unload(buf->tag,
			    buf->map);
			bus_dmamap_destroy(buf->tag,
			    buf->map);
			buf->map = NULL;
		}
	}
	if (txr->br != NULL)
		buf_ring_free(txr->br, M_DEVBUF);
	if (txr->buffers != NULL) {
		free(txr->buffers, M_DEVBUF);
		txr->buffers = NULL;
	}
	if (txr->tx_tag != NULL) {
		bus_dma_tag_destroy(txr->tx_tag);
		txr->tx_tag = NULL;
	}
	if (txr->tso_tag != NULL) {
		bus_dma_tag_destroy(txr->tso_tag);
		txr->tso_tag = NULL;
	}
	INIT_DBG_IF(que->vsi->ifp, "queue %d: end", que->me);
	return;
}
void ixl_free_que_tx ( struct ixl_queue * que ) { struct tx_ring * txr = & que -> txr ; struct ixl_tx_buf * buf ; INIT_DBG_IF ( que -> vsi -> ifp , " " , que -> me ) ; for ( int i = 0 ; i < que -> num_desc ; i ++ ) { buf = & txr -> buffers [ i ] ; if ( buf -> m_head != NULL ) { bus_dmamap_sync ( buf -> tag , buf -> map , BUS_DMASYNC_POSTWRITE ) ; bus_dmamap_unload ( buf -> tag , buf -> map ) ; m_freem ( buf -> m_head ) ; buf -> m_head = NULL ; if ( buf -> map != NULL ) { bus_dmamap_destroy ( buf -> tag , buf -> map ) ; buf -> map = NULL ; } } else if ( buf -> map != NULL ) { bus_dmamap_unload ( buf -> tag , buf -> map ) ; bus_dmamap_destroy ( buf -> tag , buf -> map ) ; buf -> map = NULL ; } } if ( txr -> br != NULL ) buf_ring_free ( txr -> br , M_DEVBUF ) ; if ( txr -> buffers != NULL ) { free ( txr -> buffers , M_DEVBUF ) ; txr -> buffers = NULL ; } if ( txr -> tx_tag != NULL ) { bus_dma_tag_destroy ( txr -> tx_tag ) ; txr -> tx_tag = NULL ; } if ( txr -> tso_tag != NULL ) { bus_dma_tag_destroy ( txr -> tso_tag ) ; txr -> tso_tag = NULL ; } INIT_DBG_IF ( que -> vsi -> ifp , " " , que -> me ) ; return ; }
Free transmit ring related data structures.
Free transmit ring related data structures .