FreeBSD/sys/dev/rt/if_rt.c
/*
 * rt_reset_tx_ring - reset TX ring buffer to empty state
 */
reset TX ring buffer to empty state
reset TX ring buffer to empty state
static void
rt_reset_tx_ring(struct rt_softc *sc, struct rt_softc_tx_ring *ring)
{
	struct rt_softc_tx_data *data;
	struct rt_txdesc *desc;
	int i;
	for (i = 0; i < RT_SOFTC_TX_RING_DESC_COUNT; i++) {
		desc = &ring->desc[i];
		desc->sdl0 = 0;
		desc->sdl1 = 0;
	}
	ring->desc_queued = 0;
	ring->desc_cur = 0;
	ring->desc_next = 0;
	bus_dmamap_sync(ring->desc_dma_tag, ring->desc_dma_map,
		BUS_DMASYNC_PREWRITE);
	bus_dmamap_sync(ring->seg0_dma_tag, ring->seg0_dma_map,
		BUS_DMASYNC_PREWRITE);
	for (i = 0; i < RT_SOFTC_TX_RING_DATA_COUNT; i++) {
		data = &ring->data[i];
		if (data->m != NULL) {
			bus_dmamap_sync(ring->data_dma_tag, data->dma_map,
				BUS_DMASYNC_POSTWRITE);
			bus_dmamap_unload(ring->data_dma_tag, data->dma_map);
			m_freem(data->m);
			data->m = NULL;
		}
	}
	ring->data_queued = 0;
	ring->data_cur = 0;
	ring->data_next = 0;
}
static void rt_reset_tx_ring ( struct rt_softc * sc , struct rt_softc_tx_ring * ring ) { struct rt_softc_tx_data * data ; struct rt_txdesc * desc ; int i ; for ( i = 0 ; i < RT_SOFTC_TX_RING_DESC_COUNT ; i ++ ) { desc = & ring -> desc [ i ] ; desc -> sdl0 = 0 ; desc -> sdl1 = 0 ; } ring -> desc_queued = 0 ; ring -> desc_cur = 0 ; ring -> desc_next = 0 ; bus_dmamap_sync ( ring -> desc_dma_tag , ring -> desc_dma_map , BUS_DMASYNC_PREWRITE ) ; bus_dmamap_sync ( ring -> seg0_dma_tag , ring -> seg0_dma_map , BUS_DMASYNC_PREWRITE ) ; for ( i = 0 ; i < RT_SOFTC_TX_RING_DATA_COUNT ; i ++ ) { data = & ring -> data [ i ] ; if ( data -> m != NULL ) { bus_dmamap_sync ( ring -> data_dma_tag , data -> dma_map , BUS_DMASYNC_POSTWRITE ) ; bus_dmamap_unload ( ring -> data_dma_tag , data -> dma_map ) ; m_freem ( data -> m ) ; data -> m = NULL ; } } ring -> data_queued = 0 ; ring -> data_cur = 0 ; ring -> data_next = 0 ; }
rt_reset_tx_ring - reset TX ring buffer to empty state
rt_reset_tx_ring - reset TX ring buffer to empty state