FreeBSD/sys/dev/stge/if_stge.c
/*
 * stge_txeof:
 *
 *	Helper; handle transmit interrupts.
 */
Helper; handle transmit interrupts.
Helper ; handle transmit interrupts .
static void
stge_txeof(struct stge_softc *sc)
{
	struct ifnet *ifp;
	struct stge_txdesc *txd;
	uint64_t control;
	int cons;
	STGE_LOCK_ASSERT(sc);
	ifp = sc->sc_ifp;
	txd = STAILQ_FIRST(&sc->sc_cdata.stge_txbusyq);
	if (txd == NULL)
		return;
	bus_dmamap_sync(sc->sc_cdata.stge_tx_ring_tag,
	    sc->sc_cdata.stge_tx_ring_map, BUS_DMASYNC_POSTREAD);
	for (cons = sc->sc_cdata.stge_tx_cons;;
	    cons = (cons + 1) % STGE_TX_RING_CNT) {
		if (sc->sc_cdata.stge_tx_cnt <= 0)
			break;
		control = le64toh(sc->sc_rdata.stge_tx_ring[cons].tfd_control);
		if ((control & TFD_TFDDone) == 0)
			break;
		sc->sc_cdata.stge_tx_cnt--;
		ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
		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;
		STAILQ_REMOVE_HEAD(&sc->sc_cdata.stge_txbusyq, tx_q);
		STAILQ_INSERT_TAIL(&sc->sc_cdata.stge_txfreeq, txd, tx_q);
		txd = STAILQ_FIRST(&sc->sc_cdata.stge_txbusyq);
	}
	sc->sc_cdata.stge_tx_cons = cons;
	if (sc->sc_cdata.stge_tx_cnt == 0)
		sc->sc_watchdog_timer = 0;
        bus_dmamap_sync(sc->sc_cdata.stge_tx_ring_tag,
	    sc->sc_cdata.stge_tx_ring_map,
	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
}
static void stge_txeof ( struct stge_softc * sc ) { struct ifnet * ifp ; struct stge_txdesc * txd ; uint64_t control ; int cons ; STGE_LOCK_ASSERT ( sc ) ; ifp = sc -> sc_ifp ; txd = STAILQ_FIRST ( & sc -> sc_cdata . stge_txbusyq ) ; if ( txd == NULL ) return ; bus_dmamap_sync ( sc -> sc_cdata . stge_tx_ring_tag , sc -> sc_cdata . stge_tx_ring_map , BUS_DMASYNC_POSTREAD ) ; for ( cons = sc -> sc_cdata . stge_tx_cons ; ; cons = ( cons + 1 ) % STGE_TX_RING_CNT ) { if ( sc -> sc_cdata . stge_tx_cnt <= 0 ) break ; control = le64toh ( sc -> sc_rdata . stge_tx_ring [ cons ] . tfd_control ) ; if ( ( control & TFD_TFDDone ) == 0 ) break ; sc -> sc_cdata . stge_tx_cnt -- ; ifp -> if_drv_flags &= ~ IFF_DRV_OACTIVE ; 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 ; STAILQ_REMOVE_HEAD ( & sc -> sc_cdata . stge_txbusyq , tx_q ) ; STAILQ_INSERT_TAIL ( & sc -> sc_cdata . stge_txfreeq , txd , tx_q ) ; txd = STAILQ_FIRST ( & sc -> sc_cdata . stge_txbusyq ) ; } sc -> sc_cdata . stge_tx_cons = cons ; if ( sc -> sc_cdata . stge_tx_cnt == 0 ) sc -> sc_watchdog_timer = 0 ; bus_dmamap_sync ( sc -> sc_cdata . stge_tx_ring_tag , sc -> sc_cdata . stge_tx_ring_map , BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE ) ; }
stge_txeof:
      Helper; handle transmit interrupts.
stge_txeof : Helper ; handle transmit interrupts .
/*
	 * Go through our Tx list and free mbufs for those
	 * frames which have been transmitted.
	 */ /* Output counter is updated with statistics register */