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