FreeBSD/sys/dev/stge/if_stge.c
/*
 *	Stop transmission on the interface.
 */
Stop transmission on the interface.
Stop transmission on the interface .
static void
stge_stop(struct stge_softc *sc)
{
	struct ifnet *ifp;
	struct stge_txdesc *txd;
	struct stge_rxdesc *rxd;
	uint32_t v;
	int i;
	STGE_LOCK_ASSERT(sc);
	callout_stop(&sc->sc_tick_ch);
	sc->sc_watchdog_timer = 0;
	CSR_WRITE_2(sc, STGE_IntEnable, 0);
	stge_stop_rx(sc);
	stge_stop_tx(sc);
	v = CSR_READ_4(sc, STGE_MACCtrl) & MC_MASK;
	v |= MC_StatisticsDisable;
	CSR_WRITE_4(sc, STGE_MACCtrl, v);
	stge_dma_wait(sc);
	CSR_WRITE_4(sc, STGE_TFDListPtrHi, 0);
	CSR_WRITE_4(sc, STGE_TFDListPtrLo, 0);
	CSR_WRITE_4(sc, STGE_RFDListPtrHi, 0);
	CSR_WRITE_4(sc, STGE_RFDListPtrLo, 0);
	for (i = 0; i < STGE_RX_RING_CNT; i++) {
		rxd = &sc->sc_cdata.stge_rxdesc[i];
		if (rxd->rx_m != NULL) {
			bus_dmamap_sync(sc->sc_cdata.stge_rx_tag,
			    rxd->rx_dmamap, BUS_DMASYNC_POSTREAD);
			bus_dmamap_unload(sc->sc_cdata.stge_rx_tag,
			    rxd->rx_dmamap);
			m_freem(rxd->rx_m);
			rxd->rx_m = NULL;
		}
        }
	for (i = 0; i < STGE_TX_RING_CNT; i++) {
		txd = &sc->sc_cdata.stge_txdesc[i];
		if (txd->tx_m != NULL) {
			bus_dmamap_sync(sc->sc_cdata.stge_tx_tag,
			    txd->tx_dmamap, BUS_DMASYNC_POSTWRITE);
			bus_dmamap_unload(sc->sc_cdata.stge_tx_tag,
			    txd->tx_dmamap);
			m_freem(txd->tx_m);
			txd->tx_m = NULL;
		}
        }
	ifp = sc->sc_ifp;
	ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
	sc->sc_link = 0;
}
static void stge_stop ( struct stge_softc * sc ) { struct ifnet * ifp ; struct stge_txdesc * txd ; struct stge_rxdesc * rxd ; uint32_t v ; int i ; STGE_LOCK_ASSERT ( sc ) ; callout_stop ( & sc -> sc_tick_ch ) ; sc -> sc_watchdog_timer = 0 ; CSR_WRITE_2 ( sc , STGE_IntEnable , 0 ) ; stge_stop_rx ( sc ) ; stge_stop_tx ( sc ) ; v = CSR_READ_4 ( sc , STGE_MACCtrl ) & MC_MASK ; v |= MC_StatisticsDisable ; CSR_WRITE_4 ( sc , STGE_MACCtrl , v ) ; stge_dma_wait ( sc ) ; CSR_WRITE_4 ( sc , STGE_TFDListPtrHi , 0 ) ; CSR_WRITE_4 ( sc , STGE_TFDListPtrLo , 0 ) ; CSR_WRITE_4 ( sc , STGE_RFDListPtrHi , 0 ) ; CSR_WRITE_4 ( sc , STGE_RFDListPtrLo , 0 ) ; for ( i = 0 ; i < STGE_RX_RING_CNT ; i ++ ) { rxd = & sc -> sc_cdata . stge_rxdesc [ i ] ; if ( rxd -> rx_m != NULL ) { bus_dmamap_sync ( sc -> sc_cdata . stge_rx_tag , rxd -> rx_dmamap , BUS_DMASYNC_POSTREAD ) ; bus_dmamap_unload ( sc -> sc_cdata . stge_rx_tag , rxd -> rx_dmamap ) ; m_freem ( rxd -> rx_m ) ; rxd -> rx_m = NULL ; } } for ( i = 0 ; i < STGE_TX_RING_CNT ; i ++ ) { txd = & sc -> sc_cdata . stge_txdesc [ i ] ; if ( txd -> tx_m != NULL ) { bus_dmamap_sync ( sc -> sc_cdata . stge_tx_tag , txd -> tx_dmamap , BUS_DMASYNC_POSTWRITE ) ; bus_dmamap_unload ( sc -> sc_cdata . stge_tx_tag , txd -> tx_dmamap ) ; m_freem ( txd -> tx_m ) ; txd -> tx_m = NULL ; } } ifp = sc -> sc_ifp ; ifp -> if_drv_flags &= ~ ( IFF_DRV_RUNNING | IFF_DRV_OACTIVE ) ; sc -> sc_link = 0 ; }
Stop transmission on the interface.
Stop transmission on the interface .
/*
	 * Stop the one second clock.
	 */ /*
	 * Disable interrupts.
	 */ /*
	 * Stop receiver, transmitter, and stats update.
	 */ /*
	 * Stop the transmit and receive DMA.
	 */ /*
	 * Free RX and TX mbufs still in the queues.
	 */ /*
	 * Mark the interface down and cancel the watchdog timer.
	 */