aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/tcp_ipv6.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2012-10-27 19:16:46 -0400
committerDavid S. Miller <davem@davemloft.net>2012-11-03 14:45:00 -0400
commite6c022a4fa2d2d9ca9d0a7ac3b05ad988f39fc30 (patch)
tree6dcd4e2dfc7895f33329fb16653a93f7d52f4bd7 /net/ipv6/tcp_ipv6.c
parent25b1e67921f448cdddf70042ba233ffe43d33a9c (diff)
tcp: better retrans tracking for defer-accept
For passive TCP connections using TCP_DEFER_ACCEPT facility, we incorrectly increment req->retrans each time timeout triggers while no SYNACK is sent. SYNACK are not sent for TCP_DEFER_ACCEPT that were established (for which we received the ACK from client). Only the last SYNACK is sent so that we can receive again an ACK from client, to move the req into accept queue. We plan to change this later to avoid the useless retransmit (and potential problem as this SYNACK could be lost) TCP_INFO later gives wrong information to user, claiming imaginary retransmits. Decouple req->retrans field into two independent fields : num_retrans : number of retransmit num_timeout : number of timeouts num_timeout is the counter that is incremented at each timeout, regardless of actual SYNACK being sent or not, and used to compute the exponential timeout. Introduce inet_rtx_syn_ack() helper to increment num_retrans only if ->rtx_syn_ack() succeeded. Use inet_rtx_syn_ack() from tcp_check_req() to increment num_retrans when we re-send a SYNACK in answer to a (retransmitted) SYN. Prior to this patch, we were not counting these retransmits. Change tcp_v[46]_rtx_synack() to increment TCP_MIB_RETRANSSEGS only if a synack packet was successfully queued. Reported-by: Yuchung Cheng <ycheng@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Julian Anastasov <ja@ssi.bg> Cc: Vijay Subramanian <subramanian.vijay@gmail.com> Cc: Elliott Hughes <enh@google.com> Cc: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r--net/ipv6/tcp_ipv6.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index bb6782e84996..c73d0ebde9c8 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -495,9 +495,12 @@ static int tcp_v6_rtx_synack(struct sock *sk, struct request_sock *req,
495 struct request_values *rvp) 495 struct request_values *rvp)
496{ 496{
497 struct flowi6 fl6; 497 struct flowi6 fl6;
498 int res;
498 499
499 TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_RETRANSSEGS); 500 res = tcp_v6_send_synack(sk, NULL, &fl6, req, rvp, 0);
500 return tcp_v6_send_synack(sk, NULL, &fl6, req, rvp, 0); 501 if (!res)
502 TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_RETRANSSEGS);
503 return res;
501} 504}
502 505
503static void tcp_v6_reqsk_destructor(struct request_sock *req) 506static void tcp_v6_reqsk_destructor(struct request_sock *req)
@@ -1364,7 +1367,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
1364 1367
1365 tcp_initialize_rcv_mss(newsk); 1368 tcp_initialize_rcv_mss(newsk);
1366 tcp_synack_rtt_meas(newsk, req); 1369 tcp_synack_rtt_meas(newsk, req);
1367 newtp->total_retrans = req->retrans; 1370 newtp->total_retrans = req->num_retrans;
1368 1371
1369 newinet->inet_daddr = newinet->inet_saddr = LOOPBACK4_IPV6; 1372 newinet->inet_daddr = newinet->inet_saddr = LOOPBACK4_IPV6;
1370 newinet->inet_rcv_saddr = LOOPBACK4_IPV6; 1373 newinet->inet_rcv_saddr = LOOPBACK4_IPV6;
@@ -1866,7 +1869,7 @@ static void get_openreq6(struct seq_file *seq,
1866 0,0, /* could print option size, but that is af dependent. */ 1869 0,0, /* could print option size, but that is af dependent. */
1867 1, /* timers active (only the expire timer) */ 1870 1, /* timers active (only the expire timer) */
1868 jiffies_to_clock_t(ttd), 1871 jiffies_to_clock_t(ttd),
1869 req->retrans, 1872 req->num_timeout,
1870 from_kuid_munged(seq_user_ns(seq), uid), 1873 from_kuid_munged(seq_user_ns(seq), uid),
1871 0, /* non standard timer */ 1874 0, /* non standard timer */
1872 0, /* open_requests have no inode */ 1875 0, /* open_requests have no inode */