FreeBSD/sys/dev/ixl/ixl_pf_main.c
/*
** Provide a update to the queue RX
** interrupt moderation value.
*/
Provide a update to the queue RX
interrupt moderation value.
Provide a update to the queue RX interrupt moderation value .
void
ixl_set_queue_rx_itr(struct ixl_queue *que)
{
	struct ixl_vsi	*vsi = que->vsi;
	struct ixl_pf	*pf = (struct ixl_pf *)vsi->back;
	struct i40e_hw	*hw = vsi->hw;
	struct rx_ring	*rxr = &que->rxr;
	u16		rx_itr;
	u16		rx_latency = 0;
	int		rx_bytes;
	if (rxr->bytes == 0)
		return;
	if (pf->dynamic_rx_itr) {
		rx_bytes = rxr->bytes/rxr->itr;
		rx_itr = rxr->itr;
		switch (rxr->latency) {
		case IXL_LOW_LATENCY:
			if (rx_bytes > 10) {
				rx_latency = IXL_AVE_LATENCY;
				rx_itr = IXL_ITR_20K;
			}
			break;
		case IXL_AVE_LATENCY:
			if (rx_bytes > 20) {
				rx_latency = IXL_BULK_LATENCY;
				rx_itr = IXL_ITR_8K;
			} else if (rx_bytes <= 10) {
				rx_latency = IXL_LOW_LATENCY;
				rx_itr = IXL_ITR_100K;
			}
			break;
		case IXL_BULK_LATENCY:
			if (rx_bytes <= 20) {
				rx_latency = IXL_AVE_LATENCY;
				rx_itr = IXL_ITR_20K;
			}
			break;
       		 }
		rxr->latency = rx_latency;
		if (rx_itr != rxr->itr) {
			rx_itr = (10 * rx_itr * rxr->itr) /
			    ((9 * rx_itr) + rxr->itr);
			rxr->itr = rx_itr & IXL_MAX_ITR;
			wr32(hw, I40E_PFINT_ITRN(IXL_RX_ITR,
			    que->me), rxr->itr);
		}
	} else { 
		if (vsi->rx_itr_setting & IXL_ITR_DYNAMIC)
			vsi->rx_itr_setting = pf->rx_itr;
		if (rxr->itr != vsi->rx_itr_setting) {
			rxr->itr = vsi->rx_itr_setting;
			wr32(hw, I40E_PFINT_ITRN(IXL_RX_ITR,
			    que->me), rxr->itr);
		}
	}
	rxr->bytes = 0;
	rxr->packets = 0;
	return;
}
void ixl_set_queue_rx_itr ( struct ixl_queue * que ) { struct ixl_vsi * vsi = que -> vsi ; struct ixl_pf * pf = ( struct ixl_pf * ) vsi -> back ; struct i40e_hw * hw = vsi -> hw ; struct rx_ring * rxr = & que -> rxr ; u16 rx_itr ; u16 rx_latency = 0 ; int rx_bytes ; if ( rxr -> bytes == 0 ) return ; if ( pf -> dynamic_rx_itr ) { rx_bytes = rxr -> bytes / rxr -> itr ; rx_itr = rxr -> itr ; switch ( rxr -> latency ) { case IXL_LOW_LATENCY : if ( rx_bytes > 10 ) { rx_latency = IXL_AVE_LATENCY ; rx_itr = IXL_ITR_20K ; } break ; case IXL_AVE_LATENCY : if ( rx_bytes > 20 ) { rx_latency = IXL_BULK_LATENCY ; rx_itr = IXL_ITR_8K ; } else if ( rx_bytes <= 10 ) { rx_latency = IXL_LOW_LATENCY ; rx_itr = IXL_ITR_100K ; } break ; case IXL_BULK_LATENCY : if ( rx_bytes <= 20 ) { rx_latency = IXL_AVE_LATENCY ; rx_itr = IXL_ITR_20K ; } break ; } rxr -> latency = rx_latency ; if ( rx_itr != rxr -> itr ) { rx_itr = ( 10 * rx_itr * rxr -> itr ) / ( ( 9 * rx_itr ) + rxr -> itr ) ; rxr -> itr = rx_itr & IXL_MAX_ITR ; wr32 ( hw , I40E_PFINT_ITRN ( IXL_RX_ITR , que -> me ) , rxr -> itr ) ; } } else { if ( vsi -> rx_itr_setting & IXL_ITR_DYNAMIC ) vsi -> rx_itr_setting = pf -> rx_itr ; if ( rxr -> itr != vsi -> rx_itr_setting ) { rxr -> itr = vsi -> rx_itr_setting ; wr32 ( hw , I40E_PFINT_ITRN ( IXL_RX_ITR , que -> me ) , rxr -> itr ) ; } } rxr -> bytes = 0 ; rxr -> packets = 0 ; return ; }
Provide a update to the queue RX
interrupt moderation value.
Provide a update to the queue RX interrupt moderation value .
/* Idle, do nothing */ /* Adjust latency range */ /* do an exponential smoothing */ /* We may have have toggled to non-dynamic */ /* Update the hardware if needed */