diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2014-05-28 10:34:49 -0400 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2014-06-04 08:56:51 -0400 |
commit | 4f4cf5ad6fc1b16dc8dc9d750bb80b35eba5e98d (patch) | |
tree | 752787b1b79b4d7c076883434bcc5650e168d1cb /net/sunrpc/xprt.c | |
parent | 18906972aa1103c07869c9b43860a52e0e27e8e5 (diff) |
SUNRPC: Move congestion window constants to header file
I would like to use one of the RPC client's congestion algorithm
constants in transport-specific code.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'net/sunrpc/xprt.c')
-rw-r--r-- | net/sunrpc/xprt.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index d173f79947c6..2d1d5a643b95 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -71,24 +71,6 @@ static void xprt_destroy(struct rpc_xprt *xprt); | |||
71 | static DEFINE_SPINLOCK(xprt_list_lock); | 71 | static DEFINE_SPINLOCK(xprt_list_lock); |
72 | static LIST_HEAD(xprt_list); | 72 | static LIST_HEAD(xprt_list); |
73 | 73 | ||
74 | /* | ||
75 | * The transport code maintains an estimate on the maximum number of out- | ||
76 | * standing RPC requests, using a smoothed version of the congestion | ||
77 | * avoidance implemented in 44BSD. This is basically the Van Jacobson | ||
78 | * congestion algorithm: If a retransmit occurs, the congestion window is | ||
79 | * halved; otherwise, it is incremented by 1/cwnd when | ||
80 | * | ||
81 | * - a reply is received and | ||
82 | * - a full number of requests are outstanding and | ||
83 | * - the congestion window hasn't been updated recently. | ||
84 | */ | ||
85 | #define RPC_CWNDSHIFT (8U) | ||
86 | #define RPC_CWNDSCALE (1U << RPC_CWNDSHIFT) | ||
87 | #define RPC_INITCWND RPC_CWNDSCALE | ||
88 | #define RPC_MAXCWND(xprt) ((xprt)->max_reqs << RPC_CWNDSHIFT) | ||
89 | |||
90 | #define RPCXPRT_CONGESTED(xprt) ((xprt)->cong >= (xprt)->cwnd) | ||
91 | |||
92 | /** | 74 | /** |
93 | * xprt_register_transport - register a transport implementation | 75 | * xprt_register_transport - register a transport implementation |
94 | * @transport: transport to register | 76 | * @transport: transport to register |
@@ -446,7 +428,15 @@ EXPORT_SYMBOL_GPL(xprt_release_rqst_cong); | |||
446 | * @task: recently completed RPC request used to adjust window | 428 | * @task: recently completed RPC request used to adjust window |
447 | * @result: result code of completed RPC request | 429 | * @result: result code of completed RPC request |
448 | * | 430 | * |
449 | * We use a time-smoothed congestion estimator to avoid heavy oscillation. | 431 | * The transport code maintains an estimate on the maximum number of out- |
432 | * standing RPC requests, using a smoothed version of the congestion | ||
433 | * avoidance implemented in 44BSD. This is basically the Van Jacobson | ||
434 | * congestion algorithm: If a retransmit occurs, the congestion window is | ||
435 | * halved; otherwise, it is incremented by 1/cwnd when | ||
436 | * | ||
437 | * - a reply is received and | ||
438 | * - a full number of requests are outstanding and | ||
439 | * - the congestion window hasn't been updated recently. | ||
450 | */ | 440 | */ |
451 | void xprt_adjust_cwnd(struct rpc_xprt *xprt, struct rpc_task *task, int result) | 441 | void xprt_adjust_cwnd(struct rpc_xprt *xprt, struct rpc_task *task, int result) |
452 | { | 442 | { |