FreeBSD/sys/dev/e1000/if_lem.c
/*********************************************************************
 *  Timer routine
 *
 *  This routine checks for link status and updates statistics.
 *
 **********************************************************************/
Timer routine
This routine checks for link status and updates statistics.
Timer routine This routine checks for link status and updates statistics .
static void
lem_local_timer(void *arg)
{
	struct adapter	*adapter = arg;
	EM_CORE_LOCK_ASSERT(adapter);
	lem_update_link_status(adapter);
	lem_update_stats_counters(adapter);
	lem_smartspeed(adapter);
#ifdef NIC_PARAVIRT
	if (adapter->csb && adapter->csb->guest_csb_on &&
	    (adapter->watchdog_check == TRUE) &&
	    (ticks - adapter->watchdog_time > EM_WATCHDOG) &&
	    (adapter->num_tx_desc_avail != adapter->num_tx_desc) ) {
		lem_txeof(adapter);
	}
#endif 
	if ((adapter->watchdog_check == TRUE) &&
	    (ticks - adapter->watchdog_time > EM_WATCHDOG))
		goto hung;
	callout_reset(&adapter->timer, hz, lem_local_timer, adapter);
	return;
hung:
	device_printf(adapter->dev, "Watchdog timeout -- resetting\n");
	if_setdrvflagbits(adapter->ifp, 0, IFF_DRV_RUNNING);
	adapter->watchdog_events++;
	lem_init_locked(adapter);
}
static void lem_local_timer ( void * arg ) { struct adapter * adapter = arg ; EM_CORE_LOCK_ASSERT ( adapter ) ; lem_update_link_status ( adapter ) ; lem_update_stats_counters ( adapter ) ; lem_smartspeed ( adapter ) ; #ifdef NIC_PARAVIRT if ( adapter -> csb && adapter -> csb -> guest_csb_on && ( adapter -> watchdog_check == TRUE ) && ( ticks - adapter -> watchdog_time > EM_WATCHDOG ) && ( adapter -> num_tx_desc_avail != adapter -> num_tx_desc ) ) { lem_txeof ( adapter ) ; } #endif if ( ( adapter -> watchdog_check == TRUE ) && ( ticks - adapter -> watchdog_time > EM_WATCHDOG ) ) goto hung ; callout_reset ( & adapter -> timer , hz , lem_local_timer , adapter ) ; return ; hung : device_printf ( adapter -> dev , " \n " ) ; if_setdrvflagbits ( adapter -> ifp , 0 , IFF_DRV_RUNNING ) ; adapter -> watchdog_events ++ ; lem_init_locked ( adapter ) ; }
Timer routine
  This routine checks for link status and updates statistics.
Timer routine This routine checks for link status and updates statistics .
/* recover space if needed */ /*
		 * lem_txeof() normally (except when space in the queue
		 * runs low XXX) cleans watchdog_check so that
		 * we do not hung.
		 */ /* NIC_PARAVIRT */ /*
	 * We check the watchdog: the time since
	 * the last TX descriptor was cleaned.
	 * This implies a functional TX engine.
	 */