1 #include <linux/version.h>
2 #include <linux/types.h>
3 #include <linux/unistd.h>
5 #include <linux/sunrpc/clnt.h>
6 #include <linux/sunrpc/xprt.h>
7 #include <linux/sunrpc/timer.h>
9 #define RPC_RTO_MAX (60*HZ)
10 #define RPC_RTO_INIT (HZ/5)
11 #define RPC_RTO_MIN (HZ/10)
14 rpc_init_rtt(struct rpc_rtt *rt, long timeo)
16 long t = (timeo - RPC_RTO_INIT) << 3;
21 for (i = 0; i < 5; i++) {
23 rt->sdrtt[i] = RPC_RTO_INIT;
25 memset(rt->ntimeouts, 0, sizeof(rt->ntimeouts));
29 rpc_update_rtt(struct rpc_rtt *rt, int timer, long m)
38 srtt = &rt->srtt[timer];
43 sdrtt = &rt->sdrtt[timer];
46 /* Set lower bound on the variance */
47 if (*sdrtt < RPC_RTO_MIN)
52 * Estimate rto for an nfs rpc sent via. an unreliable datagram.
53 * Use the mean and mean deviation of rtt for the appropriate type of rpc
54 * for the frequent rpcs and a default for the others.
55 * The justification for doing "other" this way is that these rpcs
56 * happen so infrequently that timer est. would probably be stale.
57 * Also, since many of these rpcs are
58 * non-idempotent, a conservative timeout is desired.
60 * read, write, commit - A+4D
65 rpc_calc_rto(struct rpc_rtt *rt, int timer)
70 res = (rt->srtt[timer] >> 3) + rt->sdrtt[timer];
71 if (res > RPC_RTO_MAX)