spin_unlock(&xprt->reserve_lock);
}
-/**
- * xprt_set_timeout - set constant RPC timeout
- * @to: RPC timeout parameters to set up
- * @retr: number of retries
- * @incr: amount of increase after each retry
- *
- */
-void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long incr)
-{
- to->to_initval =
- to->to_increment = incr;
- to->to_maxval = to->to_initval + (incr * retr);
- to->to_retries = retr;
- to->to_exponential = 0;
-}
-EXPORT_SYMBOL_GPL(xprt_set_timeout);
-
/**
* xprt_create_transport - create an RPC transport
* @args: rpc transport creation arguments
module_put(THIS_MODULE);
}
+static const struct rpc_timeout xprt_rdma_default_timeout = {
+ .to_initval = 60 * HZ,
+ .to_maxval = 60 * HZ,
+};
+
/**
* xprt_setup_rdma - Set up transport to use RDMA
*
}
/* 60 second timeout, no retries */
- xprt_set_timeout(&xprt->timeout, 0, 60UL * HZ);
+ memcpy(&xprt->timeout, &xprt_rdma_default_timeout, sizeof(xprt->timeout));
xprt->bind_timeout = (60U * HZ);
xprt->connect_timeout = (60U * HZ);
xprt->reestablish_timeout = (5U * HZ);
return xprt;
}
+static const struct rpc_timeout xs_udp_default_timeout = {
+ .to_initval = 5 * HZ,
+ .to_maxval = 30 * HZ,
+ .to_increment = 5 * HZ,
+ .to_retries = 5,
+};
+
/**
* xs_setup_udp - Set up transport to use a UDP socket
* @args: rpc transport creation arguments
struct sockaddr *addr = args->dstaddr;
struct rpc_xprt *xprt;
struct sock_xprt *transport;
+ const struct rpc_timeout *timeo = &xs_udp_default_timeout;
xprt = xs_setup_xprt(args, xprt_udp_slot_table_entries);
if (IS_ERR(xprt))
xprt->ops = &xs_udp_ops;
- if (args->timeout)
- xprt->timeout = *args->timeout;
- else
- xprt_set_timeout(&xprt->timeout, 5, 5 * HZ);
+ if (args->timeout != NULL)
+ timeo = args->timeout;
+ memcpy(&xprt->timeout, timeo, sizeof(xprt->timeout));
switch (addr->sa_family) {
case AF_INET:
return ERR_PTR(-EINVAL);
}
+static const struct rpc_timeout xs_tcp_default_timeout = {
+ .to_initval = 60 * HZ,
+ .to_maxval = 60 * HZ,
+ .to_retries = 2,
+};
+
/**
* xs_setup_tcp - Set up transport to use a TCP socket
* @args: rpc transport creation arguments
struct sockaddr *addr = args->dstaddr;
struct rpc_xprt *xprt;
struct sock_xprt *transport;
+ const struct rpc_timeout *timeo = &xs_tcp_default_timeout;
xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries);
if (IS_ERR(xprt))
xprt->ops = &xs_tcp_ops;
- if (args->timeout)
- xprt->timeout = *args->timeout;
- else
- xprt_set_timeout(&xprt->timeout, 2, 60 * HZ);
+ if (args->timeout != NULL)
+ timeo = args->timeout;
+ memcpy(&xprt->timeout, timeo, sizeof(xprt->timeout));
switch (addr->sa_family) {
case AF_INET: