From 4bdeac8fa5d5c6a4408ef42ec66a715c36fd27a6 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Thu, 21 Aug 2003 04:33:03 -0700 Subject: [PATCH] Increase the minimum RTO timer value to 1/10 second. This is more in line with what is done for TCP. Signedness corrections when updating RTT. Be conservative when calculating RTO. Round up the residues. --- net/sunrpc/timer.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/sunrpc/timer.c b/net/sunrpc/timer.c index bf32f588ecd80..a84e3e2b298f3 100644 --- a/net/sunrpc/timer.c +++ b/net/sunrpc/timer.c @@ -25,7 +25,7 @@ #define RPC_RTO_MAX (60*HZ) #define RPC_RTO_INIT (HZ/5) -#define RPC_RTO_MIN (2) +#define RPC_RTO_MIN (HZ/10) void rpc_init_rtt(struct rpc_rtt *rt, unsigned long timeo) @@ -50,7 +50,7 @@ rpc_init_rtt(struct rpc_rtt *rt, unsigned long timeo) void rpc_update_rtt(struct rpc_rtt *rt, unsigned timer, long m) { - unsigned long *srtt, *sdrtt; + long *srtt, *sdrtt; if (timer-- == 0) return; @@ -62,14 +62,14 @@ rpc_update_rtt(struct rpc_rtt *rt, unsigned timer, long m) if (m == 0) m = 1L; - srtt = &rt->srtt[timer]; + srtt = (long *)&rt->srtt[timer]; m -= *srtt >> 3; *srtt += m; if (m < 0) m = -m; - sdrtt = &rt->sdrtt[timer]; + sdrtt = (long *)&rt->sdrtt[timer]; m -= *sdrtt >> 2; *sdrtt += m; @@ -99,7 +99,7 @@ rpc_calc_rto(struct rpc_rtt *rt, unsigned timer) if (timer-- == 0) return rt->timeo; - res = (rt->srtt[timer] >> 3) + rt->sdrtt[timer]; + res = ((rt->srtt[timer] + 7) >> 3) + rt->sdrtt[timer]; if (res > RPC_RTO_MAX) res = RPC_RTO_MAX; -- 2.53.0