FreeBSD/sys/dev/ixl/ixl_txrx.c
/*********************************************************************
 *
 *  Free station receive ring data structures
 *
 **********************************************************************/
Free station receive ring data structures
Free station receive ring data structures
void
ixl_free_que_rx(struct ixl_queue *que)
{
	struct rx_ring		*rxr = &que->rxr;
	struct ixl_rx_buf	*buf;
	INIT_DBG_IF(que->vsi->ifp, "queue %d: begin", que->me);
	if (rxr->buffers != NULL) {
		for (int i = 0; i < que->num_desc; i++) {
			buf = &rxr->buffers[i];
			if (buf->m_head != NULL) {
				bus_dmamap_sync(rxr->htag, buf->hmap,
				    BUS_DMASYNC_POSTREAD);
				bus_dmamap_unload(rxr->htag, buf->hmap);
				buf->m_head->m_flags |= M_PKTHDR;
				m_freem(buf->m_head);
			}
			if (buf->m_pack != NULL) {
				bus_dmamap_sync(rxr->ptag, buf->pmap,
				    BUS_DMASYNC_POSTREAD);
				bus_dmamap_unload(rxr->ptag, buf->pmap);
				buf->m_pack->m_flags |= M_PKTHDR;
				m_freem(buf->m_pack);
			}
			buf->m_head = NULL;
			buf->m_pack = NULL;
			if (buf->hmap != NULL) {
				bus_dmamap_destroy(rxr->htag, buf->hmap);
				buf->hmap = NULL;
			}
			if (buf->pmap != NULL) {
				bus_dmamap_destroy(rxr->ptag, buf->pmap);
				buf->pmap = NULL;
			}
		}
		if (rxr->buffers != NULL) {
			free(rxr->buffers, M_DEVBUF);
			rxr->buffers = NULL;
		}
	}
	if (rxr->htag != NULL) {
		bus_dma_tag_destroy(rxr->htag);
		rxr->htag = NULL;
	}
	if (rxr->ptag != NULL) {
		bus_dma_tag_destroy(rxr->ptag);
		rxr->ptag = NULL;
	}
	INIT_DBG_IF(que->vsi->ifp, "queue %d: end", que->me);
	return;
}
void ixl_free_que_rx ( struct ixl_queue * que ) { struct rx_ring * rxr = & que -> rxr ; struct ixl_rx_buf * buf ; INIT_DBG_IF ( que -> vsi -> ifp , " " , que -> me ) ; if ( rxr -> buffers != NULL ) { for ( int i = 0 ; i < que -> num_desc ; i ++ ) { buf = & rxr -> buffers [ i ] ; if ( buf -> m_head != NULL ) { bus_dmamap_sync ( rxr -> htag , buf -> hmap , BUS_DMASYNC_POSTREAD ) ; bus_dmamap_unload ( rxr -> htag , buf -> hmap ) ; buf -> m_head -> m_flags |= M_PKTHDR ; m_freem ( buf -> m_head ) ; } if ( buf -> m_pack != NULL ) { bus_dmamap_sync ( rxr -> ptag , buf -> pmap , BUS_DMASYNC_POSTREAD ) ; bus_dmamap_unload ( rxr -> ptag , buf -> pmap ) ; buf -> m_pack -> m_flags |= M_PKTHDR ; m_freem ( buf -> m_pack ) ; } buf -> m_head = NULL ; buf -> m_pack = NULL ; if ( buf -> hmap != NULL ) { bus_dmamap_destroy ( rxr -> htag , buf -> hmap ) ; buf -> hmap = NULL ; } if ( buf -> pmap != NULL ) { bus_dmamap_destroy ( rxr -> ptag , buf -> pmap ) ; buf -> pmap = NULL ; } } if ( rxr -> buffers != NULL ) { free ( rxr -> buffers , M_DEVBUF ) ; rxr -> buffers = NULL ; } } if ( rxr -> htag != NULL ) { bus_dma_tag_destroy ( rxr -> htag ) ; rxr -> htag = NULL ; } if ( rxr -> ptag != NULL ) { bus_dma_tag_destroy ( rxr -> ptag ) ; rxr -> ptag = NULL ; } INIT_DBG_IF ( que -> vsi -> ifp , " " , que -> me ) ; return ; }
Free station receive ring data structures
Free station receive ring data structures
/* Cleanup any existing buffers */