source: svn/newcon3bcm2_21bu/toolchain/mips-linux-uclibc/include/linux/sunrpc/xprt.h

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 5.5 KB
Line 
1/*
2 *  linux/include/linux/sunrpc/clnt_xprt.h
3 *
4 *  Declarations for the RPC transport interface.
5 *
6 *  Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
7 */
8
9#ifndef _LINUX_SUNRPC_XPRT_H
10#define _LINUX_SUNRPC_XPRT_H
11
12#include <asm/types.h>
13
14#include <linux/uio.h>
15#include <sys/socket.h>
16#include <linux/in.h>
17#include <linux/sunrpc/sched.h>
18
19/*
20 * The transport code maintains an estimate on the maximum number of out-
21 * standing RPC requests, using a smoothed version of the congestion
22 * avoidance implemented in 44BSD. This is basically the Van Jacobson
23 * congestion algorithm: If a retransmit occurs, the congestion window is
24 * halved; otherwise, it is incremented by 1/cwnd when
25 *
26 *      -       a reply is received and
27 *      -       a full number of requests are outstanding and
28 *      -       the congestion window hasn't been updated recently.
29 *
30 * Upper procedures may check whether a request would block waiting for
31 * a free RPC slot by using the RPC_CONGESTED() macro.
32 */
33extern unsigned int xprt_udp_slot_table_entries;
34extern unsigned int xprt_tcp_slot_table_entries;
35
36#define RPC_MIN_SLOT_TABLE      (2U)
37#define RPC_DEF_SLOT_TABLE      (16U)
38#define RPC_MAX_SLOT_TABLE      (128U)
39
40#define RPC_CWNDSHIFT           (8U)
41#define RPC_CWNDSCALE           (1U << RPC_CWNDSHIFT)
42#define RPC_INITCWND            RPC_CWNDSCALE
43#define RPC_MAXCWND(xprt)       ((xprt)->max_reqs << RPC_CWNDSHIFT)
44#define RPCXPRT_CONGESTED(xprt) ((xprt)->cong >= (xprt)->cwnd)
45
46/* Default timeout values */
47#define RPC_MAX_UDP_TIMEOUT     (60*HZ)
48#define RPC_MAX_TCP_TIMEOUT     (600*HZ)
49
50/*
51 * Wait duration for an RPC TCP connection to be established.  Solaris
52 * NFS over TCP uses 60 seconds, for example, which is in line with how
53 * long a server takes to reboot.
54 */
55#define RPC_CONNECT_TIMEOUT     (60*HZ)
56
57/*
58 * Delay an arbitrary number of seconds before attempting to reconnect
59 * after an error.
60 */
61#define RPC_REESTABLISH_TIMEOUT (15*HZ)
62
63/* RPC call and reply header size as number of 32bit words (verifier
64 * size computed separately)
65 */
66#define RPC_CALLHDRSIZE         6
67#define RPC_REPHDRSIZE          4
68
69/*
70 * This describes a timeout strategy
71 */
72struct rpc_timeout {
73        unsigned long           to_initval,             /* initial timeout */
74                                to_maxval,              /* max timeout */
75                                to_increment;           /* if !exponential */
76        unsigned int            to_retries;             /* max # of retries */
77        unsigned char           to_exponential;
78};
79
80/*
81 * This describes a complete RPC request
82 */
83struct rpc_rqst {
84        /*
85         * This is the user-visible part
86         */
87        struct rpc_xprt *       rq_xprt;                /* RPC client */
88        struct xdr_buf          rq_snd_buf;             /* send buffer */
89        struct xdr_buf          rq_rcv_buf;             /* recv buffer */
90
91        /*
92         * This is the private part
93         */
94        struct rpc_task *       rq_task;        /* RPC task data */
95        __u32                   rq_xid;         /* request XID */
96        int                     rq_cong;        /* has incremented xprt->cong */
97        int                     rq_received;    /* receive completed */
98        __u32                   rq_seqno;       /* gss seq no. used on req. */
99
100        struct list_head        rq_list;
101
102        struct xdr_buf          rq_private_buf;         /* The receive buffer
103                                                         * used in the softirq.
104                                                         */
105        unsigned long           rq_majortimeo;  /* major timeout alarm */
106        unsigned long           rq_timeout;     /* Current timeout value */
107        unsigned int            rq_retries;     /* # of retries */
108        /*
109         * For authentication (e.g. auth_des)
110         */
111        __u32                   rq_creddata[2];
112       
113        /*
114         * Partial send handling
115         */
116       
117        __u32                   rq_bytes_sent;  /* Bytes we have sent */
118
119        unsigned long           rq_xtime;       /* when transmitted */
120        int                     rq_ntrans;
121};
122#define rq_svec                 rq_snd_buf.head
123#define rq_slen                 rq_snd_buf.len
124
125#define XPRT_LAST_FRAG          (1 << 0)
126#define XPRT_COPY_RECM          (1 << 1)
127#define XPRT_COPY_XID           (1 << 2)
128#define XPRT_COPY_DATA          (1 << 3)
129
130struct rpc_xprt {
131        struct socket *         sock;           /* BSD socket layer */
132        struct sock *           inet;           /* INET layer */
133
134        struct rpc_timeout      timeout;        /* timeout parms */
135        struct sockaddr_in      addr;           /* server address */
136        int                     prot;           /* IP protocol */
137
138        unsigned long           cong;           /* current congestion */
139        unsigned long           cwnd;           /* congestion window */
140
141        unsigned int            rcvsize,        /* socket receive buffer size */
142                                sndsize;        /* socket send buffer size */
143
144        size_t                  max_payload;    /* largest RPC payload size,
145                                                   in bytes */
146
147        struct rpc_wait_queue   sending;        /* requests waiting to send */
148        struct rpc_wait_queue   resend;         /* requests waiting to resend */
149        struct rpc_wait_queue   pending;        /* requests in flight */
150        struct rpc_wait_queue   backlog;        /* waiting for slot */
151        struct list_head        free;           /* free slots */
152        struct rpc_rqst *       slot;           /* slot table storage */
153        unsigned int            max_reqs;       /* total slots */
154        unsigned long           sockstate;      /* Socket state */
155        unsigned char           shutdown   : 1, /* being shut down */
156                                nocong     : 1, /* no congestion control */
157                                resvport   : 1, /* use a reserved port */
158                                stream     : 1; /* TCP */
159
160        /*
161         * XID
162         */
163        __u32                   xid;            /* Next XID value to use */
164
165        /*
166         * State of TCP reply receive stuff
167         */
168        __u32                   tcp_recm,       /* Fragment header */
169                                tcp_xid,        /* Current XID */
170                                tcp_reclen,     /* fragment length */
171                                tcp_offset;     /* fragment offset */
172        unsigned long           tcp_copied,     /* copied to request */
173                                tcp_flags;
174        /*
175         * Connection of sockets
176         */
177        struct work_struct      sock_connect;
178        unsigned short          port;
179        /*
180         * Disconnection of idle sockets
181         */
182        struct work_struct      task_cleanup;
183        struct timer_list       timer;
184        unsigned long           last_used;
185
186        /*
187         * Send stuff
188         */
189        spinlock_t              sock_lock;      /* lock socket info */
190        spinlock_t              xprt_lock;      /* lock xprt info */
191        struct rpc_task *       snd_task;       /* Task blocked in send */
192
193        struct list_head        recv;
194
195
196        void                    (*old_data_ready)(struct sock *, int);
197        void                    (*old_state_change)(struct sock *);
198        void                    (*old_write_space)(struct sock *);
199
200        wait_queue_head_t       cong_wait;
201};
202
203#endif /* _LINUX_SUNRPC_XPRT_H */
Note: See TracBrowser for help on using the repository browser.