hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/include/linux/sunrpc/xprt.h
....@@ -19,8 +19,6 @@
1919 #include <linux/sunrpc/xdr.h>
2020 #include <linux/sunrpc/msg_prot.h>
2121
22
-#ifdef __KERNEL__
23
-
2422 #define RPC_MIN_SLOT_TABLE (2U)
2523 #define RPC_DEF_SLOT_TABLE (16U)
2624 #define RPC_MAX_SLOT_TABLE_LIMIT (65536U)
....@@ -82,7 +80,14 @@
8280 struct page **rq_enc_pages; /* scratch pages for use by
8381 gss privacy code */
8482 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 */
8691
8792 void *rq_buffer; /* Call XDR encode buffer */
8893 size_t rq_callsize;
....@@ -96,6 +101,7 @@
96101 * used in the softirq.
97102 */
98103 unsigned long rq_majortimeo; /* major timeout alarm */
104
+ unsigned long rq_minortimeo; /* minor timeout alarm */
99105 unsigned long rq_timeout; /* Current timeout value */
100106 ktime_t rq_rtt; /* round-trip time */
101107 unsigned int rq_retries; /* # of retries */
....@@ -103,6 +109,7 @@
103109 /* A cookie used to track the
104110 state of the transport
105111 connection */
112
+ atomic_t rq_pin;
106113
107114 /*
108115 * Partial send handling
....@@ -133,8 +140,9 @@
133140 void (*connect)(struct rpc_xprt *xprt, struct rpc_task *task);
134141 int (*buf_alloc)(struct rpc_task *task);
135142 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);
138146 void (*timer)(struct rpc_xprt *xprt, struct rpc_task *task);
139147 void (*release_request)(struct rpc_task *task);
140148 void (*close)(struct rpc_xprt *xprt);
....@@ -148,8 +156,8 @@
148156 void (*inject_disconnect)(struct rpc_xprt *xprt);
149157 int (*bc_setup)(struct rpc_xprt *xprt,
150158 unsigned int min_reqs);
151
- int (*bc_up)(struct svc_serv *serv, struct net *net);
152159 size_t (*bc_maxpayload)(struct rpc_xprt *xprt);
160
+ unsigned int (*bc_num_slots)(struct rpc_xprt *xprt);
153161 void (*bc_free_rqst)(struct rpc_rqst *rqst);
154162 void (*bc_destroy)(struct rpc_xprt *xprt,
155163 unsigned int max_reqs);
....@@ -188,8 +196,6 @@
188196
189197 size_t max_payload; /* largest RPC payload size,
190198 in bytes */
191
- unsigned int tsh_size; /* size of transport specific
192
- header */
193199
194200 struct rpc_wait_queue binding; /* requests waiting on rpcbind */
195201 struct rpc_wait_queue sending; /* requests waiting to send */
....@@ -200,7 +206,8 @@
200206 unsigned int min_reqs; /* min number of slots */
201207 unsigned int num_reqs; /* total slots */
202208 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 */
204211 atomic_t swapper; /* we're swapping over this
205212 transport */
206213 unsigned int bind_index; /* bind function index */
....@@ -232,23 +239,29 @@
232239 /*
233240 * Send stuff
234241 */
242
+ atomic_long_t queuelen;
235243 spinlock_t transport_lock; /* lock transport info */
236244 spinlock_t reserve_lock; /* lock slot table */
237
- spinlock_t recv_lock; /* lock receive list */
245
+ spinlock_t queue_lock; /* send/receive queue lock */
238246 u32 xid; /* Next XID value to use */
239247 struct rpc_task * snd_task; /* Task blocked in send */
248
+
249
+ struct list_head xmit_queue; /* Send queue */
250
+
240251 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */
241252 #if defined(CONFIG_SUNRPC_BACKCHANNEL)
242253 struct svc_serv *bc_serv; /* The RPC service which will */
243254 /* 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 */
246258 spinlock_t bc_pa_lock; /* Protects the preallocated
247259 * items */
248260 struct list_head bc_pa_list; /* List of preallocated
249261 * backchannel rpc_rqst's */
250262 #endif /* CONFIG_SUNRPC_BACKCHANNEL */
251
- struct list_head recv;
263
+
264
+ struct rb_root recv_queue; /* Receive queue */
252265
253266 struct {
254267 unsigned long bind_count, /* total number of binds */
....@@ -325,6 +338,9 @@
325338 */
326339 struct rpc_xprt *xprt_create_transport(struct xprt_create *args);
327340 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);
328344 void xprt_reserve(struct rpc_task *task);
329345 void xprt_retry_reserve(struct rpc_task *task);
330346 int xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task);
....@@ -332,8 +348,13 @@
332348 void xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task);
333349 void xprt_free_slot(struct rpc_xprt *xprt,
334350 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);
336352 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);
337358 void xprt_transmit(struct rpc_task *task);
338359 void xprt_end_transmit(struct rpc_task *task);
339360 int xprt_adjust_timeout(struct rpc_rqst *req);
....@@ -346,11 +367,8 @@
346367 unsigned int num_prealloc,
347368 unsigned int max_req);
348369 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);
354372
355373 static inline int
356374 xprt_enable_swap(struct rpc_xprt *xprt)
....@@ -370,11 +388,11 @@
370388 int xprt_register_transport(struct xprt_class *type);
371389 int xprt_unregister_transport(struct xprt_class *type);
372390 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);
375393 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);
378396 void xprt_adjust_cwnd(struct rpc_xprt *xprt, struct rpc_task *task, int result);
379397 struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid);
380398 void xprt_update_rtt(struct rpc_task *task);
....@@ -382,6 +400,7 @@
382400 void xprt_pin_rqst(struct rpc_rqst *req);
383401 void xprt_unpin_rqst(struct rpc_rqst *req);
384402 void xprt_release_rqst_cong(struct rpc_task *task);
403
+bool xprt_request_get_cong(struct rpc_xprt *xprt, struct rpc_rqst *req);
385404 void xprt_disconnect_done(struct rpc_xprt *xprt);
386405 void xprt_force_disconnect(struct rpc_xprt *xprt);
387406 void xprt_conditional_disconnect(struct rpc_xprt *xprt, unsigned int cookie);
....@@ -400,6 +419,9 @@
400419 #define XPRT_BINDING (5)
401420 #define XPRT_CLOSING (6)
402421 #define XPRT_CONGESTED (9)
422
+#define XPRT_CWND_WAIT (10)
423
+#define XPRT_WRITE_SPACE (11)
424
+#define XPRT_SND_IS_COOKIE (12)
403425
404426 static inline void xprt_set_connected(struct rpc_xprt *xprt)
405427 {
....@@ -441,11 +463,6 @@
441463 static inline int xprt_test_and_set_connecting(struct rpc_xprt *xprt)
442464 {
443465 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);
449466 }
450467
451468 static inline void xprt_set_bound(struct rpc_xprt *xprt)
....@@ -491,7 +508,5 @@
491508 {
492509 }
493510 #endif
494
-
495
-#endif /* __KERNEL__*/
496511
497512 #endif /* _LINUX_SUNRPC_XPRT_H */