FreeBSD/sys/dev/e1000/if_em.c
/*********************************************************************
 *
 *  Legacy polling routine: note this only works with single queue
 *
 *********************************************************************/
Legacy polling routine: note this only works with single queue
Legacy polling routine : note this only works with single queue
static int
em_poll(if_t ifp, enum poll_cmd cmd, int count)
{
	struct adapter *adapter = if_getsoftc(ifp);
	struct tx_ring	*txr = adapter->tx_rings;
	struct rx_ring	*rxr = adapter->rx_rings;
	u32		reg_icr;
	int		rx_done;
	EM_CORE_LOCK(adapter);
	if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0) {
		EM_CORE_UNLOCK(adapter);
		return (0);
	}
	if (cmd == POLL_AND_CHECK_STATUS) {
		reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR);
		if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) {
			callout_stop(&adapter->timer);
			adapter->hw.mac.get_link_status = 1;
			em_update_link_status(adapter);
			callout_reset(&adapter->timer, hz,
			    em_local_timer, adapter);
		}
	}
	EM_CORE_UNLOCK(adapter);
	em_rxeof(rxr, count, &rx_done);
	EM_TX_LOCK(txr);
	em_txeof(txr);
#ifdef EM_MULTIQUEUE
	if (!drbr_empty(ifp, txr->br))
		em_mq_start_locked(ifp, txr);
#else
	if (!if_sendq_empty(ifp))
		em_start_locked(ifp, txr);
#endif
	EM_TX_UNLOCK(txr);
	return (rx_done);
}
static int em_poll ( if_t ifp , enum poll_cmd cmd , int count ) { struct adapter * adapter = if_getsoftc ( ifp ) ; struct tx_ring * txr = adapter -> tx_rings ; struct rx_ring * rxr = adapter -> rx_rings ; u32 reg_icr ; int rx_done ; EM_CORE_LOCK ( adapter ) ; if ( ( if_getdrvflags ( ifp ) & IFF_DRV_RUNNING ) == 0 ) { EM_CORE_UNLOCK ( adapter ) ; return ( 0 ) ; } if ( cmd == POLL_AND_CHECK_STATUS ) { reg_icr = E1000_READ_REG ( & adapter -> hw , E1000_ICR ) ; if ( reg_icr & ( E1000_ICR_RXSEQ | E1000_ICR_LSC ) ) { callout_stop ( & adapter -> timer ) ; adapter -> hw . mac . get_link_status = 1 ; em_update_link_status ( adapter ) ; callout_reset ( & adapter -> timer , hz , em_local_timer , adapter ) ; } } EM_CORE_UNLOCK ( adapter ) ; em_rxeof ( rxr , count , & rx_done ) ; EM_TX_LOCK ( txr ) ; em_txeof ( txr ) ; #ifdef EM_MULTIQUEUE if ( ! drbr_empty ( ifp , txr -> br ) ) em_mq_start_locked ( ifp , txr ) ; #else if ( ! if_sendq_empty ( ifp ) ) em_start_locked ( ifp , txr ) ; #endif EM_TX_UNLOCK ( txr ) ; return ( rx_done ) ; }
Legacy polling routine: note this only works with single queue
Legacy polling routine : note this only works with single queue