FreeBSD/sys/dev/ixl/if_ixlv.c
/*
** Provide a update to the queue TX
** interrupt moderation value.
*/
Provide a update to the queue TX
interrupt moderation value.
Provide a update to the queue TX interrupt moderation value .
static void
ixlv_set_queue_tx_itr(struct ixl_queue *que)
{
	struct ixl_vsi	*vsi = que->vsi;
	struct i40e_hw	*hw = vsi->hw;
	struct tx_ring	*txr = &que->txr;
	u16		tx_itr;
	u16		tx_latency = 0;
	int		tx_bytes;
	if (txr->bytes == 0)
		return;
	if (ixlv_dynamic_tx_itr) {
		tx_bytes = txr->bytes/txr->itr;
		tx_itr = txr->itr;
		switch (txr->latency) {
		case IXL_LOW_LATENCY:
			if (tx_bytes > 10) {
				tx_latency = IXL_AVE_LATENCY;
				tx_itr = IXL_ITR_20K;
			}
			break;
		case IXL_AVE_LATENCY:
			if (tx_bytes > 20) {
				tx_latency = IXL_BULK_LATENCY;
				tx_itr = IXL_ITR_8K;
			} else if (tx_bytes <= 10) {
				tx_latency = IXL_LOW_LATENCY;
				tx_itr = IXL_ITR_100K;
			}
			break;
		case IXL_BULK_LATENCY:
			if (tx_bytes <= 20) {
				tx_latency = IXL_AVE_LATENCY;
				tx_itr = IXL_ITR_20K;
			}
			break;
		}
		txr->latency = tx_latency;
		if (tx_itr != txr->itr) {
			tx_itr = (10 * tx_itr * txr->itr) /
			    ((9 * tx_itr) + txr->itr);
			txr->itr = tx_itr & IXL_MAX_ITR;
			wr32(hw, I40E_VFINT_ITRN1(IXL_TX_ITR,
			    que->me), txr->itr);
		}
	} else { 
		if (vsi->tx_itr_setting & IXL_ITR_DYNAMIC)
			vsi->tx_itr_setting = ixlv_tx_itr;
		if (txr->itr != vsi->tx_itr_setting) {
			txr->itr = vsi->tx_itr_setting;
			wr32(hw, I40E_VFINT_ITRN1(IXL_TX_ITR,
			    que->me), txr->itr);
		}
	}
	txr->bytes = 0;
	txr->packets = 0;
	return;
}
static void ixlv_set_queue_tx_itr ( struct ixl_queue * que ) { struct ixl_vsi * vsi = que -> vsi ; struct i40e_hw * hw = vsi -> hw ; struct tx_ring * txr = & que -> txr ; u16 tx_itr ; u16 tx_latency = 0 ; int tx_bytes ; if ( txr -> bytes == 0 ) return ; if ( ixlv_dynamic_tx_itr ) { tx_bytes = txr -> bytes / txr -> itr ; tx_itr = txr -> itr ; switch ( txr -> latency ) { case IXL_LOW_LATENCY : if ( tx_bytes > 10 ) { tx_latency = IXL_AVE_LATENCY ; tx_itr = IXL_ITR_20K ; } break ; case IXL_AVE_LATENCY : if ( tx_bytes > 20 ) { tx_latency = IXL_BULK_LATENCY ; tx_itr = IXL_ITR_8K ; } else if ( tx_bytes <= 10 ) { tx_latency = IXL_LOW_LATENCY ; tx_itr = IXL_ITR_100K ; } break ; case IXL_BULK_LATENCY : if ( tx_bytes <= 20 ) { tx_latency = IXL_AVE_LATENCY ; tx_itr = IXL_ITR_20K ; } break ; } txr -> latency = tx_latency ; if ( tx_itr != txr -> itr ) { tx_itr = ( 10 * tx_itr * txr -> itr ) / ( ( 9 * tx_itr ) + txr -> itr ) ; txr -> itr = tx_itr & IXL_MAX_ITR ; wr32 ( hw , I40E_VFINT_ITRN1 ( IXL_TX_ITR , que -> me ) , txr -> itr ) ; } } else { if ( vsi -> tx_itr_setting & IXL_ITR_DYNAMIC ) vsi -> tx_itr_setting = ixlv_tx_itr ; if ( txr -> itr != vsi -> tx_itr_setting ) { txr -> itr = vsi -> tx_itr_setting ; wr32 ( hw , I40E_VFINT_ITRN1 ( IXL_TX_ITR , que -> me ) , txr -> itr ) ; } } txr -> bytes = 0 ; txr -> packets = 0 ; return ; }
Provide a update to the queue TX
interrupt moderation value.
Provide a update to the queue TX interrupt moderation value .
/* Idle, do nothing */ /* do an exponential smoothing */ /* We may have have toggled to non-dynamic */ /* Update the hardware if needed */