| .. | .. |
|---|
| 19 | 19 | #include <linux/sunrpc/xdr.h> |
|---|
| 20 | 20 | #include <linux/sunrpc/msg_prot.h> |
|---|
| 21 | 21 | |
|---|
| 22 | | -#ifdef __KERNEL__ |
|---|
| 23 | | - |
|---|
| 24 | 22 | #define RPC_MIN_SLOT_TABLE (2U) |
|---|
| 25 | 23 | #define RPC_DEF_SLOT_TABLE (16U) |
|---|
| 26 | 24 | #define RPC_MAX_SLOT_TABLE_LIMIT (65536U) |
|---|
| .. | .. |
|---|
| 82 | 80 | struct page **rq_enc_pages; /* scratch pages for use by |
|---|
| 83 | 81 | gss privacy code */ |
|---|
| 84 | 82 | void (*rq_release_snd_buf)(struct rpc_rqst *); /* release rq_enc_pages */ |
|---|
| 85 | | - struct list_head rq_list; |
|---|
| 83 | + |
|---|
| 84 | + union { |
|---|
| 85 | + struct list_head rq_list; /* Slot allocation list */ |
|---|
| 86 | + struct rb_node rq_recv; /* Receive queue */ |
|---|
| 87 | + }; |
|---|
| 88 | + |
|---|
| 89 | + struct list_head rq_xmit; /* Send queue */ |
|---|
| 90 | + struct list_head rq_xmit2; /* Send queue */ |
|---|
| 86 | 91 | |
|---|
| 87 | 92 | void *rq_buffer; /* Call XDR encode buffer */ |
|---|
| 88 | 93 | size_t rq_callsize; |
|---|
| .. | .. |
|---|
| 96 | 101 | * used in the softirq. |
|---|
| 97 | 102 | */ |
|---|
| 98 | 103 | unsigned long rq_majortimeo; /* major timeout alarm */ |
|---|
| 104 | + unsigned long rq_minortimeo; /* minor timeout alarm */ |
|---|
| 99 | 105 | unsigned long rq_timeout; /* Current timeout value */ |
|---|
| 100 | 106 | ktime_t rq_rtt; /* round-trip time */ |
|---|
| 101 | 107 | unsigned int rq_retries; /* # of retries */ |
|---|
| .. | .. |
|---|
| 103 | 109 | /* A cookie used to track the |
|---|
| 104 | 110 | state of the transport |
|---|
| 105 | 111 | connection */ |
|---|
| 112 | + atomic_t rq_pin; |
|---|
| 106 | 113 | |
|---|
| 107 | 114 | /* |
|---|
| 108 | 115 | * Partial send handling |
|---|
| .. | .. |
|---|
| 133 | 140 | void (*connect)(struct rpc_xprt *xprt, struct rpc_task *task); |
|---|
| 134 | 141 | int (*buf_alloc)(struct rpc_task *task); |
|---|
| 135 | 142 | void (*buf_free)(struct rpc_task *task); |
|---|
| 136 | | - int (*send_request)(struct rpc_task *task); |
|---|
| 137 | | - void (*set_retrans_timeout)(struct rpc_task *task); |
|---|
| 143 | + void (*prepare_request)(struct rpc_rqst *req); |
|---|
| 144 | + int (*send_request)(struct rpc_rqst *req); |
|---|
| 145 | + void (*wait_for_reply_request)(struct rpc_task *task); |
|---|
| 138 | 146 | void (*timer)(struct rpc_xprt *xprt, struct rpc_task *task); |
|---|
| 139 | 147 | void (*release_request)(struct rpc_task *task); |
|---|
| 140 | 148 | void (*close)(struct rpc_xprt *xprt); |
|---|
| .. | .. |
|---|
| 148 | 156 | void (*inject_disconnect)(struct rpc_xprt *xprt); |
|---|
| 149 | 157 | int (*bc_setup)(struct rpc_xprt *xprt, |
|---|
| 150 | 158 | unsigned int min_reqs); |
|---|
| 151 | | - int (*bc_up)(struct svc_serv *serv, struct net *net); |
|---|
| 152 | 159 | size_t (*bc_maxpayload)(struct rpc_xprt *xprt); |
|---|
| 160 | + unsigned int (*bc_num_slots)(struct rpc_xprt *xprt); |
|---|
| 153 | 161 | void (*bc_free_rqst)(struct rpc_rqst *rqst); |
|---|
| 154 | 162 | void (*bc_destroy)(struct rpc_xprt *xprt, |
|---|
| 155 | 163 | unsigned int max_reqs); |
|---|
| .. | .. |
|---|
| 188 | 196 | |
|---|
| 189 | 197 | size_t max_payload; /* largest RPC payload size, |
|---|
| 190 | 198 | in bytes */ |
|---|
| 191 | | - unsigned int tsh_size; /* size of transport specific |
|---|
| 192 | | - header */ |
|---|
| 193 | 199 | |
|---|
| 194 | 200 | struct rpc_wait_queue binding; /* requests waiting on rpcbind */ |
|---|
| 195 | 201 | struct rpc_wait_queue sending; /* requests waiting to send */ |
|---|
| .. | .. |
|---|
| 200 | 206 | unsigned int min_reqs; /* min number of slots */ |
|---|
| 201 | 207 | unsigned int num_reqs; /* total slots */ |
|---|
| 202 | 208 | unsigned long state; /* transport state */ |
|---|
| 203 | | - unsigned char resvport : 1; /* use a reserved port */ |
|---|
| 209 | + unsigned char resvport : 1, /* use a reserved port */ |
|---|
| 210 | + reuseport : 1; /* reuse port on reconnect */ |
|---|
| 204 | 211 | atomic_t swapper; /* we're swapping over this |
|---|
| 205 | 212 | transport */ |
|---|
| 206 | 213 | unsigned int bind_index; /* bind function index */ |
|---|
| .. | .. |
|---|
| 232 | 239 | /* |
|---|
| 233 | 240 | * Send stuff |
|---|
| 234 | 241 | */ |
|---|
| 242 | + atomic_long_t queuelen; |
|---|
| 235 | 243 | spinlock_t transport_lock; /* lock transport info */ |
|---|
| 236 | 244 | spinlock_t reserve_lock; /* lock slot table */ |
|---|
| 237 | | - spinlock_t recv_lock; /* lock receive list */ |
|---|
| 245 | + spinlock_t queue_lock; /* send/receive queue lock */ |
|---|
| 238 | 246 | u32 xid; /* Next XID value to use */ |
|---|
| 239 | 247 | struct rpc_task * snd_task; /* Task blocked in send */ |
|---|
| 248 | + |
|---|
| 249 | + struct list_head xmit_queue; /* Send queue */ |
|---|
| 250 | + |
|---|
| 240 | 251 | struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */ |
|---|
| 241 | 252 | #if defined(CONFIG_SUNRPC_BACKCHANNEL) |
|---|
| 242 | 253 | struct svc_serv *bc_serv; /* The RPC service which will */ |
|---|
| 243 | 254 | /* process the callback */ |
|---|
| 244 | | - int bc_alloc_count; /* Total number of preallocs */ |
|---|
| 245 | | - atomic_t bc_free_slots; |
|---|
| 255 | + unsigned int bc_alloc_max; |
|---|
| 256 | + unsigned int bc_alloc_count; /* Total number of preallocs */ |
|---|
| 257 | + atomic_t bc_slot_count; /* Number of allocated slots */ |
|---|
| 246 | 258 | spinlock_t bc_pa_lock; /* Protects the preallocated |
|---|
| 247 | 259 | * items */ |
|---|
| 248 | 260 | struct list_head bc_pa_list; /* List of preallocated |
|---|
| 249 | 261 | * backchannel rpc_rqst's */ |
|---|
| 250 | 262 | #endif /* CONFIG_SUNRPC_BACKCHANNEL */ |
|---|
| 251 | | - struct list_head recv; |
|---|
| 263 | + |
|---|
| 264 | + struct rb_root recv_queue; /* Receive queue */ |
|---|
| 252 | 265 | |
|---|
| 253 | 266 | struct { |
|---|
| 254 | 267 | unsigned long bind_count, /* total number of binds */ |
|---|
| .. | .. |
|---|
| 325 | 338 | */ |
|---|
| 326 | 339 | struct rpc_xprt *xprt_create_transport(struct xprt_create *args); |
|---|
| 327 | 340 | void xprt_connect(struct rpc_task *task); |
|---|
| 341 | +unsigned long xprt_reconnect_delay(const struct rpc_xprt *xprt); |
|---|
| 342 | +void xprt_reconnect_backoff(struct rpc_xprt *xprt, |
|---|
| 343 | + unsigned long init_to); |
|---|
| 328 | 344 | void xprt_reserve(struct rpc_task *task); |
|---|
| 329 | 345 | void xprt_retry_reserve(struct rpc_task *task); |
|---|
| 330 | 346 | int xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task); |
|---|
| .. | .. |
|---|
| 332 | 348 | void xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task); |
|---|
| 333 | 349 | void xprt_free_slot(struct rpc_xprt *xprt, |
|---|
| 334 | 350 | struct rpc_rqst *req); |
|---|
| 335 | | -void xprt_lock_and_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task); |
|---|
| 351 | +void xprt_request_prepare(struct rpc_rqst *req); |
|---|
| 336 | 352 | bool xprt_prepare_transmit(struct rpc_task *task); |
|---|
| 353 | +void xprt_request_enqueue_transmit(struct rpc_task *task); |
|---|
| 354 | +void xprt_request_enqueue_receive(struct rpc_task *task); |
|---|
| 355 | +void xprt_request_wait_receive(struct rpc_task *task); |
|---|
| 356 | +void xprt_request_dequeue_xprt(struct rpc_task *task); |
|---|
| 357 | +bool xprt_request_need_retransmit(struct rpc_task *task); |
|---|
| 337 | 358 | void xprt_transmit(struct rpc_task *task); |
|---|
| 338 | 359 | void xprt_end_transmit(struct rpc_task *task); |
|---|
| 339 | 360 | int xprt_adjust_timeout(struct rpc_rqst *req); |
|---|
| .. | .. |
|---|
| 346 | 367 | unsigned int num_prealloc, |
|---|
| 347 | 368 | unsigned int max_req); |
|---|
| 348 | 369 | void xprt_free(struct rpc_xprt *); |
|---|
| 349 | | - |
|---|
| 350 | | -static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *p) |
|---|
| 351 | | -{ |
|---|
| 352 | | - return p + xprt->tsh_size; |
|---|
| 353 | | -} |
|---|
| 370 | +void xprt_add_backlog(struct rpc_xprt *xprt, struct rpc_task *task); |
|---|
| 371 | +bool xprt_wake_up_backlog(struct rpc_xprt *xprt, struct rpc_rqst *req); |
|---|
| 354 | 372 | |
|---|
| 355 | 373 | static inline int |
|---|
| 356 | 374 | xprt_enable_swap(struct rpc_xprt *xprt) |
|---|
| .. | .. |
|---|
| 370 | 388 | int xprt_register_transport(struct xprt_class *type); |
|---|
| 371 | 389 | int xprt_unregister_transport(struct xprt_class *type); |
|---|
| 372 | 390 | int xprt_load_transport(const char *); |
|---|
| 373 | | -void xprt_set_retrans_timeout_def(struct rpc_task *task); |
|---|
| 374 | | -void xprt_set_retrans_timeout_rtt(struct rpc_task *task); |
|---|
| 391 | +void xprt_wait_for_reply_request_def(struct rpc_task *task); |
|---|
| 392 | +void xprt_wait_for_reply_request_rtt(struct rpc_task *task); |
|---|
| 375 | 393 | void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status); |
|---|
| 376 | | -void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action); |
|---|
| 377 | | -void xprt_write_space(struct rpc_xprt *xprt); |
|---|
| 394 | +void xprt_wait_for_buffer_space(struct rpc_xprt *xprt); |
|---|
| 395 | +bool xprt_write_space(struct rpc_xprt *xprt); |
|---|
| 378 | 396 | void xprt_adjust_cwnd(struct rpc_xprt *xprt, struct rpc_task *task, int result); |
|---|
| 379 | 397 | struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid); |
|---|
| 380 | 398 | void xprt_update_rtt(struct rpc_task *task); |
|---|
| .. | .. |
|---|
| 382 | 400 | void xprt_pin_rqst(struct rpc_rqst *req); |
|---|
| 383 | 401 | void xprt_unpin_rqst(struct rpc_rqst *req); |
|---|
| 384 | 402 | void xprt_release_rqst_cong(struct rpc_task *task); |
|---|
| 403 | +bool xprt_request_get_cong(struct rpc_xprt *xprt, struct rpc_rqst *req); |
|---|
| 385 | 404 | void xprt_disconnect_done(struct rpc_xprt *xprt); |
|---|
| 386 | 405 | void xprt_force_disconnect(struct rpc_xprt *xprt); |
|---|
| 387 | 406 | void xprt_conditional_disconnect(struct rpc_xprt *xprt, unsigned int cookie); |
|---|
| .. | .. |
|---|
| 400 | 419 | #define XPRT_BINDING (5) |
|---|
| 401 | 420 | #define XPRT_CLOSING (6) |
|---|
| 402 | 421 | #define XPRT_CONGESTED (9) |
|---|
| 422 | +#define XPRT_CWND_WAIT (10) |
|---|
| 423 | +#define XPRT_WRITE_SPACE (11) |
|---|
| 424 | +#define XPRT_SND_IS_COOKIE (12) |
|---|
| 403 | 425 | |
|---|
| 404 | 426 | static inline void xprt_set_connected(struct rpc_xprt *xprt) |
|---|
| 405 | 427 | { |
|---|
| .. | .. |
|---|
| 441 | 463 | static inline int xprt_test_and_set_connecting(struct rpc_xprt *xprt) |
|---|
| 442 | 464 | { |
|---|
| 443 | 465 | return test_and_set_bit(XPRT_CONNECTING, &xprt->state); |
|---|
| 444 | | -} |
|---|
| 445 | | - |
|---|
| 446 | | -static inline int xprt_close_wait(struct rpc_xprt *xprt) |
|---|
| 447 | | -{ |
|---|
| 448 | | - return test_bit(XPRT_CLOSE_WAIT, &xprt->state); |
|---|
| 449 | 466 | } |
|---|
| 450 | 467 | |
|---|
| 451 | 468 | static inline void xprt_set_bound(struct rpc_xprt *xprt) |
|---|
| .. | .. |
|---|
| 491 | 508 | { |
|---|
| 492 | 509 | } |
|---|
| 493 | 510 | #endif |
|---|
| 494 | | - |
|---|
| 495 | | -#endif /* __KERNEL__*/ |
|---|
| 496 | 511 | |
|---|
| 497 | 512 | #endif /* _LINUX_SUNRPC_XPRT_H */ |
|---|