diff options
author | Wei Wang <weiwan@google.com> | 2018-07-31 20:46:22 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-08-01 12:56:10 -0400 |
commit | fb31c9b9f6c85b1bad569ecedbde78d9e37cd87b (patch) | |
tree | 7568903b4ab7b5784169b51d342ffb28ec6e31e2 /net/ipv4/tcp.c | |
parent | ba113c3aa79a7f941ac162d05a3620bdc985c58d (diff) |
tcp: add data bytes retransmitted stats
Introduce a new TCP stat to record the number of bytes retransmitted
(RFC4898 tcpEStatsPerfOctetsRetrans) and expose it in both tcp_info
(TCP_INFO) and opt_stats (SOF_TIMESTAMPING_OPT_STATS).
Signed-off-by: Wei Wang <weiwan@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r-- | net/ipv4/tcp.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 873cb9968ff5..5ed1be88e922 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -2595,6 +2595,7 @@ int tcp_disconnect(struct sock *sk, int flags) | |||
2595 | tcp_saved_syn_free(tp); | 2595 | tcp_saved_syn_free(tp); |
2596 | tp->compressed_ack = 0; | 2596 | tp->compressed_ack = 0; |
2597 | tp->bytes_sent = 0; | 2597 | tp->bytes_sent = 0; |
2598 | tp->bytes_retrans = 0; | ||
2598 | 2599 | ||
2599 | /* Clean up fastopen related fields */ | 2600 | /* Clean up fastopen related fields */ |
2600 | tcp_free_fastopen_req(tp); | 2601 | tcp_free_fastopen_req(tp); |
@@ -3203,6 +3204,7 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) | |||
3203 | info->tcpi_delivered = tp->delivered; | 3204 | info->tcpi_delivered = tp->delivered; |
3204 | info->tcpi_delivered_ce = tp->delivered_ce; | 3205 | info->tcpi_delivered_ce = tp->delivered_ce; |
3205 | info->tcpi_bytes_sent = tp->bytes_sent; | 3206 | info->tcpi_bytes_sent = tp->bytes_sent; |
3207 | info->tcpi_bytes_retrans = tp->bytes_retrans; | ||
3206 | unlock_sock_fast(sk, slow); | 3208 | unlock_sock_fast(sk, slow); |
3207 | } | 3209 | } |
3208 | EXPORT_SYMBOL_GPL(tcp_get_info); | 3210 | EXPORT_SYMBOL_GPL(tcp_get_info); |
@@ -3228,6 +3230,7 @@ static size_t tcp_opt_stats_get_size(void) | |||
3228 | nla_total_size(sizeof(u32)) + /* TCP_NLA_DELIVERED */ | 3230 | nla_total_size(sizeof(u32)) + /* TCP_NLA_DELIVERED */ |
3229 | nla_total_size(sizeof(u32)) + /* TCP_NLA_DELIVERED_CE */ | 3231 | nla_total_size(sizeof(u32)) + /* TCP_NLA_DELIVERED_CE */ |
3230 | nla_total_size_64bit(sizeof(u64)) + /* TCP_NLA_BYTES_SENT */ | 3232 | nla_total_size_64bit(sizeof(u64)) + /* TCP_NLA_BYTES_SENT */ |
3233 | nla_total_size_64bit(sizeof(u64)) + /* TCP_NLA_BYTES_RETRANS */ | ||
3231 | 0; | 3234 | 0; |
3232 | } | 3235 | } |
3233 | 3236 | ||
@@ -3277,6 +3280,8 @@ struct sk_buff *tcp_get_timestamping_opt_stats(const struct sock *sk) | |||
3277 | 3280 | ||
3278 | nla_put_u64_64bit(stats, TCP_NLA_BYTES_SENT, tp->bytes_sent, | 3281 | nla_put_u64_64bit(stats, TCP_NLA_BYTES_SENT, tp->bytes_sent, |
3279 | TCP_NLA_PAD); | 3282 | TCP_NLA_PAD); |
3283 | nla_put_u64_64bit(stats, TCP_NLA_BYTES_RETRANS, tp->bytes_retrans, | ||
3284 | TCP_NLA_PAD); | ||
3280 | 3285 | ||
3281 | return stats; | 3286 | return stats; |
3282 | } | 3287 | } |