/* NB: When computing the smoothed RTT and standard deviation, be careful not to produce negative intermediate results.  */
void rpc_update_rtt(struct rpc_rtt *rt, unsigned timer, long m)
/* NB: When computing the smoothed RTT and standard deviation, be careful not to produce negative intermediate results.  */
void rpc_update_rtt(struct rpc_rtt *rt, unsigned timer, long m)
{
	long *srtt, *sdrtt;
	if (timer-- == 0)
		return;
	if (m < 0)
		return;
	if (m == 0)
		m = 1L;
	srtt = (long *)&rt->srtt[timer];
	m -= *srtt >> 3;
	*srtt += m;
	if (m < 0)
		m = -m;
	sdrtt = (long *)&rt->sdrtt[timer];
	m -= *sdrtt >> 2;
	*sdrtt += m;
	if (*sdrtt < RPC_RTO_MIN)
		*sdrtt = RPC_RTO_MIN;
}