9 #ifndef _LINUX_SUNRPC_XPRT_H
10 #define _LINUX_SUNRPC_XPRT_H
12 #include <linux/uio.h>
13 #include <linux/socket.h>
22 #define RPC_MIN_SLOT_TABLE (2U)
23 #define RPC_DEF_SLOT_TABLE (16U)
24 #define RPC_MAX_SLOT_TABLE_LIMIT (65536U)
25 #define RPC_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE_LIMIT
31 unsigned long to_initval,
34 unsigned int to_retries;
35 unsigned char to_exponential;
38 enum rpc_display_format_t {
59 struct rpc_xprt * rq_xprt;
60 struct xdr_buf rq_snd_buf;
61 struct xdr_buf rq_rcv_buf;
67 struct rpc_cred * rq_cred;
72 struct page **rq_enc_pages;
74 void (*rq_release_snd_buf)(
struct rpc_rqst *);
80 size_t rq_xmit_bytes_sent;
81 size_t rq_reply_bytes_recvd;
84 struct xdr_buf rq_private_buf;
87 unsigned long rq_majortimeo;
88 unsigned long rq_timeout;
90 unsigned int rq_retries;
91 unsigned int rq_connect_cookie;
104 #if defined(CONFIG_SUNRPC_BACKCHANNEL)
106 unsigned long rq_bc_pa_state;
110 #define rq_svec rq_snd_buf.head
111 #define rq_slen rq_snd_buf.len
113 struct rpc_xprt_ops {
114 void (*set_buffer_size)(
struct rpc_xprt *xprt,
size_t sndsize,
size_t rcvsize);
119 void (*set_port)(
struct rpc_xprt *xprt,
unsigned short port);
127 void (*close)(
struct rpc_xprt *xprt);
141 #define XPRT_TRANSPORT_BC (1 << 31)
142 enum xprt_transports {
145 XPRT_TRANSPORT_BC_TCP =
IPPROTO_TCP | XPRT_TRANSPORT_BC,
146 XPRT_TRANSPORT_RDMA = 256,
147 XPRT_TRANSPORT_LOCAL = 257,
152 struct rpc_xprt_ops *
ops;
154 const struct rpc_timeout *
timeout;
164 unsigned int tsh_size;
172 unsigned int max_reqs;
173 unsigned int min_reqs;
176 unsigned char resvport : 1;
177 unsigned int swapper;
179 unsigned int bind_index;
184 unsigned long bind_timeout,
186 unsigned int connect_cookie;
195 unsigned long last_used,
206 #if defined(CONFIG_SUNRPC_BACKCHANNEL)
209 unsigned int bc_alloc_count;
218 unsigned long bind_count,
227 unsigned long long req_u,
233 struct net *xprt_net;
234 const char *servername;
235 const char *address_strings[RPC_DISPLAY_MAX];
238 #if defined(CONFIG_SUNRPC_BACKCHANNEL)
242 #define RPC_BC_PA_IN_USE 0x0001
246 #if defined(CONFIG_SUNRPC_BACKCHANNEL)
247 static inline int bc_prealloc(
struct rpc_rqst *
req)
249 return test_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state);
252 static inline int bc_prealloc(
struct rpc_rqst *
req)
264 const char *servername;
271 struct rpc_xprt * (*setup)(
struct xprt_create *);
293 struct rpc_xprt *
xprt_get(
struct rpc_xprt *xprt);
294 void xprt_put(
struct rpc_xprt *xprt);
296 unsigned int num_prealloc,
297 unsigned int max_req);
300 static inline __be32 *xprt_skip_transport_header(
struct rpc_xprt *xprt,
__be32 *
p)
302 return p + xprt->tsh_size;
323 int xs_swapper(
struct rpc_xprt *xprt,
int enable);
328 #define XPRT_LOCKED (0)
329 #define XPRT_CONNECTED (1)
330 #define XPRT_CONNECTING (2)
331 #define XPRT_CLOSE_WAIT (3)
332 #define XPRT_BOUND (4)
333 #define XPRT_BINDING (5)
334 #define XPRT_CLOSING (6)
335 #define XPRT_CONNECTION_ABORT (7)
336 #define XPRT_CONNECTION_CLOSE (8)
338 static inline void xprt_set_connected(
struct rpc_xprt *xprt)
340 set_bit(XPRT_CONNECTED, &xprt->state);
343 static inline void xprt_clear_connected(
struct rpc_xprt *xprt)
348 static inline int xprt_connected(
struct rpc_xprt *xprt)
350 return test_bit(XPRT_CONNECTED, &xprt->state);
353 static inline int xprt_test_and_set_connected(
struct rpc_xprt *xprt)
358 static inline int xprt_test_and_clear_connected(
struct rpc_xprt *xprt)
363 static inline void xprt_clear_connecting(
struct rpc_xprt *xprt)
366 clear_bit(XPRT_CONNECTING, &xprt->state);
370 static inline int xprt_connecting(
struct rpc_xprt *xprt)
372 return test_bit(XPRT_CONNECTING, &xprt->state);
375 static inline int xprt_test_and_set_connecting(
struct rpc_xprt *xprt)
380 static inline void xprt_set_bound(
struct rpc_xprt *xprt)
385 static inline int xprt_bound(
struct rpc_xprt *xprt)
387 return test_bit(XPRT_BOUND, &xprt->state);
390 static inline void xprt_clear_bound(
struct rpc_xprt *xprt)
395 static inline void xprt_clear_binding(
struct rpc_xprt *xprt)
402 static inline int xprt_test_and_set_binding(
struct rpc_xprt *xprt)