Skip to content

Commit 4f4cf5a

Browse files
chuckleveramschuma-ntap
authored andcommitted
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>
1 parent 1890697 commit 4f4cf5a

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

include/linux/sunrpc/xprt.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
#define RPC_MAX_SLOT_TABLE_LIMIT (65536U)
2525
#define RPC_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE_LIMIT
2626

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+
2733
/*
2834
* This describes a timeout strategy
2935
*/

net/sunrpc/xprt.c

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -71,24 +71,6 @@ static void xprt_destroy(struct rpc_xprt *xprt);
7171
static DEFINE_SPINLOCK(xprt_list_lock);
7272
static LIST_HEAD(xprt_list);
7373

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-
9274
/**
9375
* xprt_register_transport - register a transport implementation
9476
* @transport: transport to register
@@ -446,7 +428,15 @@ EXPORT_SYMBOL_GPL(xprt_release_rqst_cong);
446428
* @task: recently completed RPC request used to adjust window
447429
* @result: result code of completed RPC request
448430
*
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.
450440
*/
451441
void xprt_adjust_cwnd(struct rpc_xprt *xprt, struct rpc_task *task, int result)
452442
{

0 commit comments

Comments
 (0)