1
2
3
4
5
6
7
8
9#ifndef _LINUX_SUNRPC_TIMER_H
10#define _LINUX_SUNRPC_TIMER_H
11
12#include <linux/atomic.h>
13
14struct rpc_rtt {
15 unsigned long timeo;
16 unsigned long srtt[5];
17 unsigned long sdrtt[5];
18 int ntimeouts[5];
19};
20
21
22extern void rpc_init_rtt(struct rpc_rtt *rt, unsigned long timeo);
23extern void rpc_update_rtt(struct rpc_rtt *rt, unsigned timer, long m);
24extern unsigned long rpc_calc_rto(struct rpc_rtt *rt, unsigned timer);
25
26static inline void rpc_set_timeo(struct rpc_rtt *rt, int timer, int ntimeo)
27{
28 int *t;
29 if (!timer)
30 return;
31 t = &rt->ntimeouts[timer-1];
32 if (ntimeo < *t) {
33 if (*t > 0)
34 (*t)--;
35 } else {
36 if (ntimeo > 8)
37 ntimeo = 8;
38 *t = ntimeo;
39 }
40}
41
42static inline int rpc_ntimeo(struct rpc_rtt *rt, int timer)
43{
44 if (!timer)
45 return 0;
46 return rt->ntimeouts[timer-1];
47}
48
49#endif
50