aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtsock.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r--net/sunrpc/xprtsock.c29
1 files changed, 21 insertions, 8 deletions
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: