From 05a6b5eb48c733ec9f5747b5ab9e155a8a1ad42d Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Wed, 20 Oct 2004 07:21:01 -0700 Subject: [PATCH] [TCP]: Add total num retransmits accounting. Signed-off-by: David S. Miller --- include/linux/tcp.h | 4 ++++ net/ipv4/tcp_diag.c | 2 ++ net/ipv4/tcp_output.c | 2 ++ 3 files changed, 8 insertions(+) diff --git a/include/linux/tcp.h b/include/linux/tcp.h index f374df7a823f9..0902b9f496c39 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -186,6 +186,8 @@ struct tcp_info __u32 tcpi_rcv_rtt; __u32 tcpi_rcv_space; + + __u32 tcpi_total_retrans; }; #ifdef __KERNEL__ @@ -364,6 +366,8 @@ struct tcp_opt { __u8 urg_mode; /* In urgent mode */ __u32 snd_up; /* Urgent pointer */ + __u32 total_retrans; /* Total retransmits for entire connection */ + /* The syn_wait_lock is necessary only to avoid proc interface having * to grab the main lock sock while browsing the listening hash * (otherwise it's deadlock prone). diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c index 915b35b41ebcd..481b9c7cbd7cc 100644 --- a/net/ipv4/tcp_diag.c +++ b/net/ipv4/tcp_diag.c @@ -105,6 +105,8 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) info->tcpi_rcv_rtt = jiffies_to_usecs(tp->rcv_rtt_est.rtt)>>3; info->tcpi_rcv_space = tp->rcvq_space.space; + + info->tcpi_total_retrans = tp->total_retrans; } static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk, diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 7091380606442..4cd0dbc2ea00d 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1106,6 +1106,8 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) /* Update global TCP statistics. */ TCP_INC_STATS(TCP_MIB_RETRANSSEGS); + tp->total_retrans++; + #if FASTRETRANS_DEBUG > 0 if (TCP_SKB_CB(skb)->sacked&TCPCB_SACKED_RETRANS) { if (net_ratelimit()) -- 2.53.0