aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/sunrpc/xprt.h6
-rw-r--r--net/sunrpc/xprt.c28
2 files changed, 15 insertions, 19 deletions
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 3e5efb2b236e..5903d2c0ab4d 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -24,6 +24,12 @@
24#define RPC_MAX_SLOT_TABLE_LIMIT (65536U) 24#define RPC_MAX_SLOT_TABLE_LIMIT (65536U)
25#define RPC_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE_LIMIT 25#define RPC_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE_LIMIT
26 26
27#define RPC_CWNDSHIFT (8U)
28#define RPC_CWNDSCALE (1U << RPC_CWNDSHIFT)
29#define RPC_INITCWND RPC_CWNDSCALE
30#define RPC_MAXCWND(xprt) ((xprt)->max_reqs << RPC_CWNDSHIFT)
31#define RPCXPRT_CONGESTED(xprt) ((xprt)->cong >= (xprt)->cwnd)
32
27/* 33/*
28 * This describes a timeout strategy 34 * This describes a timeout strategy
29 */ 35 */
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);
71static DEFINE_SPINLOCK(xprt_list_lock); 71static DEFINE_SPINLOCK(xprt_list_lock);
72static LIST_HEAD(xprt_list); 72static 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 */
451void xprt_adjust_cwnd(struct rpc_xprt *xprt, struct rpc_task *task, int result) 441void xprt_adjust_cwnd(struct rpc_xprt *xprt, struct rpc_task *task, int result)
452{ 442{