aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
authorYuchung Cheng <ycheng@google.com>2018-04-18 02:18:46 -0400
committerDavid S. Miller <davem@davemloft.net>2018-04-19 13:05:16 -0400
commitbef5767f37cfe42b1cf1ae60f01cfb4e16a7a2b8 (patch)
tree7b50df5aac4c33c0b4a1d360eb9d06216cdcfad3 /net/ipv4/tcp_input.c
parent415787d7799f4fccbe8d49cb0b8e5811be6b0389 (diff)
tcp: better delivery accounting for SYN-ACK and SYN-data
the tcp_sock:delivered has inconsistent accounting for SYN and FIN. 1. it counts pure FIN 2. it counts pure SYN 3. it counts SYN-data twice 4. it does not count SYN-ACK For congestion control perspective it does not matter much as C.C. only cares about the difference not the aboslute value. But the next patch would export this field to user-space so it's better to report the absolute value w/o these caveats. This patch counts SYN, SYN-ACK, or SYN-data delivery once always in the "delivered" field. Signed-off-by: Yuchung Cheng <ycheng@google.com> Reviewed-by: Neal Cardwell <ncardwell@google.com> Reviewed-by: Soheil Hassas Yeganeh <soheil@google.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r--net/ipv4/tcp_input.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index f93687f97d80..2499248d4a67 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5567,9 +5567,12 @@ static bool tcp_rcv_fastopen_synack(struct sock *sk, struct sk_buff *synack,
5567 return true; 5567 return true;
5568 } 5568 }
5569 tp->syn_data_acked = tp->syn_data; 5569 tp->syn_data_acked = tp->syn_data;
5570 if (tp->syn_data_acked) 5570 if (tp->syn_data_acked) {
5571 NET_INC_STATS(sock_net(sk), 5571 NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPFASTOPENACTIVE);
5572 LINUX_MIB_TCPFASTOPENACTIVE); 5572 /* SYN-data is counted as two separate packets in tcp_ack() */
5573 if (tp->delivered > 1)
5574 --tp->delivered;
5575 }
5573 5576
5574 tcp_fastopen_add_skb(sk, synack); 5577 tcp_fastopen_add_skb(sk, synack);
5575 5578
@@ -5901,6 +5904,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
5901 } 5904 }
5902 switch (sk->sk_state) { 5905 switch (sk->sk_state) {
5903 case TCP_SYN_RECV: 5906 case TCP_SYN_RECV:
5907 tp->delivered++; /* SYN-ACK delivery isn't tracked in tcp_ack */
5904 if (!tp->srtt_us) 5908 if (!tp->srtt_us)
5905 tcp_synack_rtt_meas(sk, req); 5909 tcp_synack_rtt_meas(sk, req);
5906 5910