0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _LINUX_SUNRPC_TIMER_H
0011 #define _LINUX_SUNRPC_TIMER_H
0012
0013 #include <linux/atomic.h>
0014
0015 struct rpc_rtt {
0016 unsigned long timeo;
0017 unsigned long srtt[5];
0018 unsigned long sdrtt[5];
0019 int ntimeouts[5];
0020 };
0021
0022
0023 extern void rpc_init_rtt(struct rpc_rtt *rt, unsigned long timeo);
0024 extern void rpc_update_rtt(struct rpc_rtt *rt, unsigned timer, long m);
0025 extern unsigned long rpc_calc_rto(struct rpc_rtt *rt, unsigned timer);
0026
0027 static inline void rpc_set_timeo(struct rpc_rtt *rt, int timer, int ntimeo)
0028 {
0029 int *t;
0030 if (!timer)
0031 return;
0032 t = &rt->ntimeouts[timer-1];
0033 if (ntimeo < *t) {
0034 if (*t > 0)
0035 (*t)--;
0036 } else {
0037 if (ntimeo > 8)
0038 ntimeo = 8;
0039 *t = ntimeo;
0040 }
0041 }
0042
0043 static inline int rpc_ntimeo(struct rpc_rtt *rt, int timer)
0044 {
0045 if (!timer)
0046 return 0;
0047 return rt->ntimeouts[timer-1];
0048 }
0049
0050 #endif