/* calculate: 4.096x2^ack_timeout = 4.096x2^ack_delay + 2x4.096x2^life_time Because of how ack_timeout is stored, adding one doubles the timeout. To avoid large timeouts, select the max(ack_delay, life_time + 1), and increment it (round up) only if the other is within 50%.  */
static u8 cm_ack_timeout(u8 ca_ack_delay, u8 packet_life_time)
/* calculate: 4.096x2^ack_timeout = 4.096x2^ack_delay + 2x4.096x2^life_time Because of how ack_timeout is stored, adding one doubles the timeout. To avoid large timeouts, select the max(ack_delay, life_time + 1), and increment it (round up) only if the other is within 50%.  */
static u8 cm_ack_timeout(u8 ca_ack_delay, u8 packet_life_time)
{
	int ack_timeout = packet_life_time + 1;
	if (ack_timeout >= ca_ack_delay)
		ack_timeout += (ca_ack_delay >= (ack_timeout - 1));
	else
		ack_timeout = ca_ack_delay +
			      (ack_timeout >= (ca_ack_delay - 1));
	return min(31, ack_timeout);
}