aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r--net/ipv4/tcp.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 6d30ca559c64..cf0850c068f5 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2110,12 +2110,15 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
2110 break; 2110 break;
2111 2111
2112 case TCP_DEFER_ACCEPT: 2112 case TCP_DEFER_ACCEPT:
2113 if (val < 0) { 2113 icsk->icsk_accept_queue.rskq_defer_accept = 0;
2114 err = -EINVAL; 2114 if (val > 0) {
2115 } else { 2115 /* Translate value in seconds to number of
2116 if (val > MAX_TCP_ACCEPT_DEFERRED) 2116 * retransmits */
2117 val = MAX_TCP_ACCEPT_DEFERRED; 2117 while (icsk->icsk_accept_queue.rskq_defer_accept < 32 &&
2118 icsk->icsk_accept_queue.rskq_defer_accept = val; 2118 val > ((TCP_TIMEOUT_INIT / HZ) <<
2119 icsk->icsk_accept_queue.rskq_defer_accept))
2120 icsk->icsk_accept_queue.rskq_defer_accept++;
2121 icsk->icsk_accept_queue.rskq_defer_accept++;
2119 } 2122 }
2120 break; 2123 break;
2121 2124
@@ -2297,7 +2300,8 @@ static int do_tcp_getsockopt(struct sock *sk, int level,
2297 val = (val ? : sysctl_tcp_fin_timeout) / HZ; 2300 val = (val ? : sysctl_tcp_fin_timeout) / HZ;
2298 break; 2301 break;
2299 case TCP_DEFER_ACCEPT: 2302 case TCP_DEFER_ACCEPT:
2300 val = icsk->icsk_accept_queue.rskq_defer_accept; 2303 val = !icsk->icsk_accept_queue.rskq_defer_accept ? 0 :
2304 ((TCP_TIMEOUT_INIT / HZ) << (icsk->icsk_accept_queue.rskq_defer_accept - 1));
2301 break; 2305 break;
2302 case TCP_WINDOW_CLAMP: 2306 case TCP_WINDOW_CLAMP:
2303 val = tp->window_clamp; 2307 val = tp->window_clamp;