All of lore.kernel.org
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@davemloft.net>
To: Lennert Buytenhek <buytenh@wantstofly.org>
Cc: netdev@oss.sgi.com
Subject: Re: way of figuring out total number of retransmitted packets on a TCP socket?
Date: Wed, 20 Oct 2004 21:37:39 -0700	[thread overview]
Message-ID: <20041020213739.6e669fdd.davem@davemloft.net> (raw)
In-Reply-To: <20041020223547.GJ29583@xi.wantstofly.org>


Please give this 2.6.x patch a spin:

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/10/20 21:21:01-07:00 davem@nuts.davemloft.net 
#   [TCP]: Add total num retransmits accounting.
#   
#   Signed-off-by: David S. Miller <davem@davemloft.net>
# 
# net/ipv4/tcp_output.c
#   2004/10/20 21:20:29-07:00 davem@nuts.davemloft.net +2 -0
#   [TCP]: Add total num retransmits accounting.
# 
# net/ipv4/tcp_diag.c
#   2004/10/20 21:20:29-07:00 davem@nuts.davemloft.net +2 -0
#   [TCP]: Add total num retransmits accounting.
# 
# include/linux/tcp.h
#   2004/10/20 21:20:29-07:00 davem@nuts.davemloft.net +4 -0
#   [TCP]: Add total num retransmits accounting.
# 
diff -Nru a/include/linux/tcp.h b/include/linux/tcp.h
--- a/include/linux/tcp.h	2004-10-20 21:21:21 -07:00
+++ b/include/linux/tcp.h	2004-10-20 21:21:21 -07:00
@@ -186,6 +186,8 @@
 
 	__u32	tcpi_rcv_rtt;
 	__u32	tcpi_rcv_space;
+
+	__u32	tcpi_total_retrans;
 };
 
 #ifdef __KERNEL__
@@ -363,6 +365,8 @@
 	__u8	pending;	/* Scheduled timer event	*/
 	__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
diff -Nru a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c
--- a/net/ipv4/tcp_diag.c	2004-10-20 21:21:21 -07:00
+++ b/net/ipv4/tcp_diag.c	2004-10-20 21:21:21 -07:00
@@ -105,6 +105,8 @@
 
 	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 -Nru a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
--- a/net/ipv4/tcp_output.c	2004-10-20 21:21:21 -07:00
+++ b/net/ipv4/tcp_output.c	2004-10-20 21:21:22 -07:00
@@ -1106,6 +1106,8 @@
 		/* 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())

  parent reply	other threads:[~2004-10-21  4:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-20 13:01 way of figuring out total number of retransmitted packets on a TCP socket? Lennert Buytenhek
2004-10-20 13:25 ` Baruch Even
2004-10-20 22:16   ` David S. Miller
2004-10-20 22:14 ` David S. Miller
2004-10-20 22:35   ` Lennert Buytenhek
2004-10-20 22:53     ` David S. Miller
2004-10-20 23:04       ` Andi Kleen
2004-10-20 23:07         ` David S. Miller
2004-10-20 23:27           ` Andi Kleen
2004-10-20 23:42             ` David S. Miller
2004-10-21  1:18               ` Arnaldo Carvalho de Melo
2004-10-20 23:44         ` Lennert Buytenhek
2004-10-20 23:44           ` David S. Miller
2004-10-21  9:01             ` Lennert Buytenhek
2004-10-21  4:37     ` David S. Miller [this message]
2004-10-26 13:47       ` Lennert Buytenhek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041020213739.6e669fdd.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=buytenh@wantstofly.org \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.