FreeBSD/sys/dev/ixl/ixl_pf_main.c
/*********************************************************************
 *  Timer routine
 *
 *  This routine checks for link status,updates statistics,
 *  and runs the watchdog check.
 *
 *  Only runs when the driver is configured UP and RUNNING.
 *
 **********************************************************************/
Timer routine
This routine checks for link status,updates statistics,
and runs the watchdog check.

Only runs when the driver is configured UP and RUNNING.
Timer routine This routine checks for link status updates statistics and runs the watchdog check . Only runs when the driver is configured UP and RUNNING .
void
ixl_local_timer(void *arg)
{
	struct ixl_pf		*pf = arg;
	struct i40e_hw		*hw = &pf->hw;
	struct ixl_vsi		*vsi = &pf->vsi;
	struct ixl_queue	*que = vsi->queues;
	device_t		dev = pf->dev;
	int			hung = 0;
	u32			mask;
	mtx_assert(&pf->pf_mtx, MA_OWNED);
	taskqueue_enqueue(pf->tq, &pf->adminq);
	ixl_update_stats_counters(pf);
	mask = (I40E_PFINT_DYN_CTLN_INTENA_MASK |
		I40E_PFINT_DYN_CTLN_SWINT_TRIG_MASK);
	for (int i = 0; i < vsi->num_queues; i++, que++) {
		if (que->busy)
			wr32(hw, I40E_PFINT_DYN_CTLN(que->me), mask);
		if (que->busy == IXL_QUEUE_HUNG) {
			++hung;
			continue;
		}
		if (que->busy >= IXL_MAX_TX_BUSY) {
#ifdef IXL_DEBUG
			device_printf(dev, "Warning queue %d "
			    "appears to be hung!\n", i);
#endif
			que->busy = IXL_QUEUE_HUNG;
			++hung;
		}
	}
	if (hung == vsi->num_queues)
		goto hung;
	callout_reset(&pf->timer, hz, ixl_local_timer, pf);
	return;
hung:
	device_printf(dev, "Local Timer: HANG DETECT - Resetting!!\n");
	ixl_init_locked(pf);
}
void ixl_local_timer ( void * arg ) { struct ixl_pf * pf = arg ; struct i40e_hw * hw = & pf -> hw ; struct ixl_vsi * vsi = & pf -> vsi ; struct ixl_queue * que = vsi -> queues ; device_t dev = pf -> dev ; int hung = 0 ; u32 mask ; mtx_assert ( & pf -> pf_mtx , MA_OWNED ) ; taskqueue_enqueue ( pf -> tq , & pf -> adminq ) ; ixl_update_stats_counters ( pf ) ; mask = ( I40E_PFINT_DYN_CTLN_INTENA_MASK | I40E_PFINT_DYN_CTLN_SWINT_TRIG_MASK ) ; for ( int i = 0 ; i < vsi -> num_queues ; i ++ , que ++ ) { if ( que -> busy ) wr32 ( hw , I40E_PFINT_DYN_CTLN ( que -> me ) , mask ) ; if ( que -> busy == IXL_QUEUE_HUNG ) { ++ hung ; continue ; } if ( que -> busy >= IXL_MAX_TX_BUSY ) { #ifdef IXL_DEBUG device_printf ( dev , " " " \n " , i ) ; #endif que -> busy = IXL_QUEUE_HUNG ; ++ hung ; } } if ( hung == vsi -> num_queues ) goto hung ; callout_reset ( & pf -> timer , hz , ixl_local_timer , pf ) ; return ; hung : device_printf ( dev , " \n " ) ; ixl_init_locked ( pf ) ; }
Timer routine
  This routine checks for link status,updates statistics,
  and runs the watchdog check.
Timer routine This routine checks for link status updates statistics and runs the watchdog check .
/* Fire off the adminq task */ /* Update stats */ /* Check status of the queues */ /* Any queues with outstanding work get a sw irq */ /*
		** Each time txeof runs without cleaning, but there
		** are uncleaned descriptors it increments busy. If
		** we get to 5 we declare it hung.
		*/ /* Only reinit if all queues show hung */