/* ixgbe_update_itr - update the dynamic ITR value based on statistics @adapter: pointer to adapter @eitr: eitr setting (ints per sec) to give last timeslice @itr_setting: current throttle rate in ints/second @packets: the number of packets during this measurement interval @bytes: the number of bytes during this measurement interval  */
static u8 ixgbe_update_itr(struct ixgbe_adapter *adapter, u32 eitr, u8 itr_setting, int packets, int bytes)
/* ixgbe_update_itr - update the dynamic ITR value based on statistics @adapter: pointer to adapter @eitr: eitr setting (ints per sec) to give last timeslice @itr_setting: current throttle rate in ints/second @packets: the number of packets during this measurement interval @bytes: the number of bytes during this measurement interval  */
static u8 ixgbe_update_itr(struct ixgbe_adapter *adapter, u32 eitr, u8 itr_setting, int packets, int bytes)
{
	unsigned int retval = itr_setting;
	u32 timepassed_us;
	u64 bytes_perint;
	if (packets == 0)
		goto update_itr_done;
	timepassed_us = 1000000/eitr;
	bytes_perint = bytes / timepassed_us;
	switch (itr_setting) {
	case lowest_latency:
		if (bytes_perint > adapter->eitr_low)
			retval = low_latency;
		break;
	case low_latency:
		if (bytes_perint > adapter->eitr_high)
			retval = bulk_latency;
		else if (bytes_perint <= adapter->eitr_low)
			retval = lowest_latency;
		break;
	case bulk_latency:
		if (bytes_perint <= adapter->eitr_high)
			retval = low_latency;
		break;
	}
update_itr_done:
	return retval;
}