aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/sunrpc/xprt.h5
-rw-r--r--net/sunrpc/xprt.c17
-rw-r--r--net/sunrpc/xprtrdma/transport.c7
-rw-r--r--net/sunrpc/xprtsock.c29
4 files changed, 27 insertions, 31 deletions
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 2554cd2b016f..a00d4a4ba6ee 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -203,11 +203,6 @@ struct xprt_class {
203}; 203};
204 204
205/* 205/*
206 * Transport operations used by ULPs
207 */
208void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long incr);
209
210/*
211 * Generic internal transport functions 206 * Generic internal transport functions
212 */ 207 */
213struct rpc_xprt *xprt_create_transport(struct xprt_create *args); 208struct rpc_xprt *xprt_create_transport(struct xprt_create *args);
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 7520c6623c46..2bc99569c586 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -978,23 +978,6 @@ void xprt_release(struct rpc_task *task)
978} 978}
979 979
980/** 980/**
981 * xprt_set_timeout - set constant RPC timeout
982 * @to: RPC timeout parameters to set up
983 * @retr: number of retries
984 * @incr: amount of increase after each retry
985 *
986 */
987void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long incr)
988{
989 to->to_initval =
990 to->to_increment = incr;
991 to->to_maxval = to->to_initval + (incr * retr);
992 to->to_retries = retr;
993 to->to_exponential = 0;
994}
995EXPORT_SYMBOL_GPL(xprt_set_timeout);
996
997/**
998 * xprt_create_transport - create an RPC transport 981 * xprt_create_transport - create an RPC transport
999 * @args: rpc transport creation arguments 982 * @args: rpc transport creation arguments
1000 * 983 *
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index 73033d824eed..39f10016c86b 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -289,6 +289,11 @@ xprt_rdma_destroy(struct rpc_xprt *xprt)
289 module_put(THIS_MODULE); 289 module_put(THIS_MODULE);
290} 290}
291 291
292static const struct rpc_timeout xprt_rdma_default_timeout = {
293 .to_initval = 60 * HZ,
294 .to_maxval = 60 * HZ,
295};
296
292/** 297/**
293 * xprt_setup_rdma - Set up transport to use RDMA 298 * xprt_setup_rdma - Set up transport to use RDMA
294 * 299 *
@@ -327,7 +332,7 @@ xprt_setup_rdma(struct xprt_create *args)
327 } 332 }
328 333
329 /* 60 second timeout, no retries */ 334 /* 60 second timeout, no retries */
330 xprt_set_timeout(&xprt->timeout, 0, 60UL * HZ); 335 memcpy(&xprt->timeout, &xprt_rdma_default_timeout, sizeof(xprt->timeout));
331 xprt->bind_timeout = (60U * HZ); 336 xprt->bind_timeout = (60U * HZ);
332 xprt->connect_timeout = (60U * HZ); 337 xprt->connect_timeout = (60U * HZ);
333 xprt->reestablish_timeout = (5U * HZ); 338 xprt->reestablish_timeout = (5U * HZ);
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index a4cfdc5b2648..d7b07ac5b710 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1895,6 +1895,13 @@ static struct rpc_xprt *xs_setup_xprt(struct xprt_create *args,
1895 return xprt; 1895 return xprt;
1896} 1896}
1897 1897
1898static const struct rpc_timeout xs_udp_default_timeout = {
1899 .to_initval = 5 * HZ,
1900 .to_maxval = 30 * HZ,
1901 .to_increment = 5 * HZ,
1902 .to_retries = 5,
1903};
1904
1898/** 1905/**
1899 * xs_setup_udp - Set up transport to use a UDP socket 1906 * xs_setup_udp - Set up transport to use a UDP socket
1900 * @args: rpc transport creation arguments 1907 * @args: rpc transport creation arguments
@@ -1905,6 +1912,7 @@ static struct rpc_xprt *xs_setup_udp(struct xprt_create *args)
1905 struct sockaddr *addr = args->dstaddr; 1912 struct sockaddr *addr = args->dstaddr;
1906 struct rpc_xprt *xprt; 1913 struct rpc_xprt *xprt;
1907 struct sock_xprt *transport; 1914 struct sock_xprt *transport;
1915 const struct rpc_timeout *timeo = &xs_udp_default_timeout;
1908 1916
1909 xprt = xs_setup_xprt(args, xprt_udp_slot_table_entries); 1917 xprt = xs_setup_xprt(args, xprt_udp_slot_table_entries);
1910 if (IS_ERR(xprt)) 1918 if (IS_ERR(xprt))
@@ -1923,10 +1931,9 @@ static struct rpc_xprt *xs_setup_udp(struct xprt_create *args)
1923 1931
1924 xprt->ops = &xs_udp_ops; 1932 xprt->ops = &xs_udp_ops;
1925 1933
1926 if (args->timeout) 1934 if (args->timeout != NULL)
1927 xprt->timeout = *args->timeout; 1935 timeo = args->timeout;
1928 else 1936 memcpy(&xprt->timeout, timeo, sizeof(xprt->timeout));
1929 xprt_set_timeout(&xprt->timeout, 5, 5 * HZ);
1930 1937
1931 switch (addr->sa_family) { 1938 switch (addr->sa_family) {
1932 case AF_INET: 1939 case AF_INET:
@@ -1961,6 +1968,12 @@ static struct rpc_xprt *xs_setup_udp(struct xprt_create *args)
1961 return ERR_PTR(-EINVAL); 1968 return ERR_PTR(-EINVAL);
1962} 1969}
1963 1970
1971static const struct rpc_timeout xs_tcp_default_timeout = {
1972 .to_initval = 60 * HZ,
1973 .to_maxval = 60 * HZ,
1974 .to_retries = 2,
1975};
1976
1964/** 1977/**
1965 * xs_setup_tcp - Set up transport to use a TCP socket 1978 * xs_setup_tcp - Set up transport to use a TCP socket
1966 * @args: rpc transport creation arguments 1979 * @args: rpc transport creation arguments
@@ -1971,6 +1984,7 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args)
1971 struct sockaddr *addr = args->dstaddr; 1984 struct sockaddr *addr = args->dstaddr;
1972 struct rpc_xprt *xprt; 1985 struct rpc_xprt *xprt;
1973 struct sock_xprt *transport; 1986 struct sock_xprt *transport;
1987 const struct rpc_timeout *timeo = &xs_tcp_default_timeout;
1974 1988
1975 xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries); 1989 xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries);
1976 if (IS_ERR(xprt)) 1990 if (IS_ERR(xprt))
@@ -1988,10 +2002,9 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args)
1988 2002
1989 xprt->ops = &xs_tcp_ops; 2003 xprt->ops = &xs_tcp_ops;
1990 2004
1991 if (args->timeout) 2005 if (args->timeout != NULL)
1992 xprt->timeout = *args->timeout; 2006 timeo = args->timeout;
1993 else 2007 memcpy(&xprt->timeout, timeo, sizeof(xprt->timeout));
1994 xprt_set_timeout(&xprt->timeout, 2, 60 * HZ);
1995 2008
1996 switch (addr->sa_family) { 2009 switch (addr->sa_family) {
1997 case AF_INET: 2010 case AF_INET: