1/* 2 * linux/include/linux/sunrpc/timer.h 3 * 4 * Declarations for the RPC transport timer. 5 * 6 * Copyright (C) 2002 Trond Myklebust <trond.myklebust@fys.uio.no> 7 */ 8 9#ifndef _LINUX_SUNRPC_TIMER_H 10#define _LINUX_SUNRPC_TIMER_H 11 12#include <asm/atomic.h> 13 14struct rpc_rtt { 15 long timeo; /* default timeout value */ 16 long srtt[5]; /* smoothed round trip time << 3 */ 17 long sdrtt[5]; /* soothed medium deviation of RTT */ 18 atomic_t ntimeouts; /* Global count of the number of timeouts */ 19}; 20 21 22extern void rpc_init_rtt(struct rpc_rtt *rt, long timeo); 23extern void rpc_update_rtt(struct rpc_rtt *rt, int timer, long m); 24extern long rpc_calc_rto(struct rpc_rtt *rt, int timer); 25 26static inline void rpc_inc_timeo(struct rpc_rtt *rt) 27{ 28 atomic_inc(&rt->ntimeouts); 29} 30 31static inline void rpc_clear_timeo(struct rpc_rtt *rt) 32{ 33 atomic_set(&rt->ntimeouts, 0); 34} 35 36static inline int rpc_ntimeo(struct rpc_rtt *rt) 37{ 38 return atomic_read(&rt->ntimeouts); 39} 40 41#endif /* _LINUX_SUNRPC_TIMER_H */ 42