FreeBSD/sys/dev/cadence/if_cgem.c
/* Turn off interface.  Free up any buffers in transmit or receive queues. */
Turn off interface.  Free up any buffers in transmit or receive queues.
Turn off interface . Free up any buffers in transmit or receive queues .
static void
cgem_stop(struct cgem_softc *sc)
{
	int i;
	CGEM_ASSERT_LOCKED(sc);
	callout_stop(&sc->tick_ch);
	cgem_reset(sc);
	for (i = 0; i < CGEM_NUM_TX_DESCS; i++) {
		sc->txring[i].ctl = CGEM_TXDESC_USED;
		sc->txring[i].addr = 0;
		if (sc->txring_m[i]) {
			bus_dmamap_unload(sc->mbuf_dma_tag,
					  sc->txring_m_dmamap[i]);
			bus_dmamap_destroy(sc->mbuf_dma_tag,
					   sc->txring_m_dmamap[i]);
			sc->txring_m_dmamap[i] = NULL;
			m_freem(sc->txring_m[i]);
			sc->txring_m[i] = NULL;
		}
	}
	sc->txring[CGEM_NUM_TX_DESCS - 1].ctl |= CGEM_TXDESC_WRAP;
	sc->txring_hd_ptr = 0;
	sc->txring_tl_ptr = 0;
	sc->txring_queued = 0;
	for (i = 0; i < CGEM_NUM_RX_DESCS; i++) {
		sc->rxring[i].addr = CGEM_RXDESC_OWN;
		sc->rxring[i].ctl = 0;
		if (sc->rxring_m[i]) {
			bus_dmamap_unload(sc->mbuf_dma_tag,
				  sc->rxring_m_dmamap[i]);
			bus_dmamap_destroy(sc->mbuf_dma_tag,
				   sc->rxring_m_dmamap[i]);
			sc->rxring_m_dmamap[i] = NULL;
			m_freem(sc->rxring_m[i]);
			sc->rxring_m[i] = NULL;
		}
	}
	sc->rxring[CGEM_NUM_RX_DESCS - 1].addr |= CGEM_RXDESC_WRAP;
	sc->rxring_hd_ptr = 0;
	sc->rxring_tl_ptr = 0;
	sc->rxring_queued = 0;
	sc->mii_media_active = 0;
}
static void cgem_stop ( struct cgem_softc * sc ) { int i ; CGEM_ASSERT_LOCKED ( sc ) ; callout_stop ( & sc -> tick_ch ) ; cgem_reset ( sc ) ; for ( i = 0 ; i < CGEM_NUM_TX_DESCS ; i ++ ) { sc -> txring [ i ] . ctl = CGEM_TXDESC_USED ; sc -> txring [ i ] . addr = 0 ; if ( sc -> txring_m [ i ] ) { bus_dmamap_unload ( sc -> mbuf_dma_tag , sc -> txring_m_dmamap [ i ] ) ; bus_dmamap_destroy ( sc -> mbuf_dma_tag , sc -> txring_m_dmamap [ i ] ) ; sc -> txring_m_dmamap [ i ] = NULL ; m_freem ( sc -> txring_m [ i ] ) ; sc -> txring_m [ i ] = NULL ; } } sc -> txring [ CGEM_NUM_TX_DESCS - 1 ] . ctl |= CGEM_TXDESC_WRAP ; sc -> txring_hd_ptr = 0 ; sc -> txring_tl_ptr = 0 ; sc -> txring_queued = 0 ; for ( i = 0 ; i < CGEM_NUM_RX_DESCS ; i ++ ) { sc -> rxring [ i ] . addr = CGEM_RXDESC_OWN ; sc -> rxring [ i ] . ctl = 0 ; if ( sc -> rxring_m [ i ] ) { bus_dmamap_unload ( sc -> mbuf_dma_tag , sc -> rxring_m_dmamap [ i ] ) ; bus_dmamap_destroy ( sc -> mbuf_dma_tag , sc -> rxring_m_dmamap [ i ] ) ; sc -> rxring_m_dmamap [ i ] = NULL ; m_freem ( sc -> rxring_m [ i ] ) ; sc -> rxring_m [ i ] = NULL ; } } sc -> rxring [ CGEM_NUM_RX_DESCS - 1 ] . addr |= CGEM_RXDESC_WRAP ; sc -> rxring_hd_ptr = 0 ; sc -> rxring_tl_ptr = 0 ; sc -> rxring_queued = 0 ; sc -> mii_media_active = 0 ; }
Turn off interface.
Turn off interface .
/* Shut down hardware. */ /* Clear out transmit queue. */ /* Unload and destroy dmamap. */ /* Clear out receive queue. */ /* Unload and destroy dmamap. */ /* Force next statchg or linkchg to program net config register. */