Skip to content

Commit bfaee09

Browse files
chuckleveramschuma-ntap
authored andcommitted
xprtrdma: Use macros for reconnection timeout constants
Clean up: Ensure the same max and min constant values are used everywhere when setting reconnect timeouts. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent 196c699 commit bfaee09

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

net/sunrpc/xprtrdma/transport.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ static struct ctl_table sunrpc_table[] = {
149149

150150
#endif
151151

152+
#define RPCRDMA_BIND_TO (60U * HZ)
153+
#define RPCRDMA_INIT_REEST_TO (5U * HZ)
154+
#define RPCRDMA_MAX_REEST_TO (30U * HZ)
155+
#define RPCRDMA_IDLE_DISC_TO (5U * 60 * HZ)
156+
152157
static struct rpc_xprt_ops xprt_rdma_procs; /* forward reference */
153158

154159
static void
@@ -285,9 +290,9 @@ xprt_setup_rdma(struct xprt_create *args)
285290

286291
/* 60 second timeout, no retries */
287292
xprt->timeout = &xprt_rdma_default_timeout;
288-
xprt->bind_timeout = (60U * HZ);
289-
xprt->reestablish_timeout = (5U * HZ);
290-
xprt->idle_timeout = (5U * 60 * HZ);
293+
xprt->bind_timeout = RPCRDMA_BIND_TO;
294+
xprt->reestablish_timeout = RPCRDMA_INIT_REEST_TO;
295+
xprt->idle_timeout = RPCRDMA_IDLE_DISC_TO;
291296

292297
xprt->resvport = 0; /* privileged port not needed */
293298
xprt->tsh_size = 0; /* RPC-RDMA handles framing */
@@ -432,10 +437,10 @@ xprt_rdma_connect(struct rpc_xprt *xprt, struct rpc_task *task)
432437
schedule_delayed_work(&r_xprt->rdma_connect,
433438
xprt->reestablish_timeout);
434439
xprt->reestablish_timeout <<= 1;
435-
if (xprt->reestablish_timeout > (30 * HZ))
436-
xprt->reestablish_timeout = (30 * HZ);
437-
else if (xprt->reestablish_timeout < (5 * HZ))
438-
xprt->reestablish_timeout = (5 * HZ);
440+
if (xprt->reestablish_timeout > RPCRDMA_MAX_REEST_TO)
441+
xprt->reestablish_timeout = RPCRDMA_MAX_REEST_TO;
442+
else if (xprt->reestablish_timeout < RPCRDMA_INIT_REEST_TO)
443+
xprt->reestablish_timeout = RPCRDMA_INIT_REEST_TO;
439444
} else {
440445
schedule_delayed_work(&r_xprt->rdma_connect, 0);
441446
if (!RPC_IS_ASYNC(task))

0 commit comments

Comments
 (0)