2 * rpcsock.h Declarations for the RPC call interface.
4 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
8 #ifndef _LINUX_RPCSOCK_H
9 #define _LINUX_RPCSOCK_H
12 * The rpcsock code maintains an estimate on the maximum number of out-
13 * standing RPC requests, using the congestion avoidance implemented in
14 * 44BSD. This is basically the Van Jacobson slow start algorithm: If a
15 * retransmit occurs, the congestion window is halved; otherwise, it is
16 * incremented by 1/cwnd when a reply is received and a full number of
17 * requests are outstanding.
19 * Upper procedures may check whether a request would block waiting for
20 * a free RPC slot by using the RPC_CONGESTED() macro.
22 * Note: on machines with low memory we should probably use a smaller
23 * MAXREQS value: At 32 outstanding reqs with 8 megs of RAM, fragment
24 * reassembly will frequently run out of memory.
26 #define RPC_MAXREQS 32
27 #define RPC_CWNDSCALE 256
28 #define RPC_MAXCWND (RPC_MAXREQS * RPC_CWNDSCALE)
29 /* #define RPC_INITCWND (RPC_MAXCWND / 2) */
30 #define RPC_INITCWND RPC_CWNDSCALE
31 #define RPC_CONGESTED(rsock) ((rsock)->cong >= (rsock)->cwnd)
33 /* RPC reply header size: xid, direction, status, accept_status (verifier
34 * size computed separately)
36 #define RPC_HDRSIZE (4 * 4)
39 * This describes a timeout strategy
42 unsigned long to_initval
,
50 * This describes a complete RPC request
53 struct rpc_wait
* rq_slot
;
54 struct sockaddr
* rq_addr
;
56 struct iovec rq_svec
[UIO_FASTIOV
];
58 unsigned long rq_slen
;
59 struct iovec rq_rvec
[UIO_FASTIOV
];
61 unsigned long rq_rlen
;
65 * This is the callback handler for async RPC.
68 typedef void (*rpc_callback_fn_t
)(int, struct rpc_wait
*, void *);
71 * Wait information. This struct defines all the state of an RPC
72 * request currently in flight.
75 struct rpc_sock
* w_sock
;
76 struct rpc_wait
* w_prev
;
77 struct rpc_wait
* w_next
;
78 struct rpc_ioreq
* w_req
;
80 wait_queue_head_t w_wait
;
81 rpc_callback_fn_t w_handler
;
92 struct rpc_wait waiting
[RPC_MAXREQS
];
95 struct rpc_wait
* pending
;
96 struct rpc_wait
* free
;
97 wait_queue_head_t backlog
;
98 wait_queue_head_t shutwait
;
104 /* rpc_call: Call synchronously */
105 int rpc_call(struct rpc_sock
*, struct rpc_ioreq
*,
106 struct rpc_timeout
*);
107 /* These implement asynch calls for nfsiod: Process calls rpc_reserve and
108 * rpc_transmits, then passes the request to nfsiod, which collects the
109 * results via rpc_doio
111 int rpc_reserve(struct rpc_sock
*, struct rpc_ioreq
*, int);
112 void rpc_release(struct rpc_sock
*, struct rpc_ioreq
*);
113 int rpc_transmit(struct rpc_sock
*, struct rpc_ioreq
*);
114 int rpc_doio(struct rpc_sock
*, struct rpc_ioreq
*,
115 struct rpc_timeout
*, int);
116 struct rpc_sock
* rpc_makesock(struct file
*);
117 int rpc_closesock(struct rpc_sock
*);
119 #endif /* __KERNEL__*/
121 #endif /* _LINUX_RPCSOCK_H */