Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Jan 2011 18:27:01 +0000 (UTC)
From:      "George V. Neville-Neil" <gnn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r216968 - stable/8/sys/netinet
Message-ID:  <201101041827.p04IR1Be050411@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gnn
Date: Tue Jan  4 18:27:00 2011
New Revision: 216968
URL: http://svn.freebsd.org/changeset/base/216968

Log:
  MFC: 215434, 215724
  
  Add new, per connection, statistics for TCP, including:
  Retransmitted Packets
  Zero Window Advertisements
  Out of Order Receives
  
  These statistics are available via the -T argument to
  netstat(1).

Modified:
  stable/8/sys/netinet/tcp.h
  stable/8/sys/netinet/tcp_output.c
  stable/8/sys/netinet/tcp_reass.c
  stable/8/sys/netinet/tcp_usrreq.c
  stable/8/sys/netinet/tcp_var.h

Modified: stable/8/sys/netinet/tcp.h
==============================================================================
--- stable/8/sys/netinet/tcp.h	Tue Jan  4 17:27:17 2011	(r216967)
+++ stable/8/sys/netinet/tcp.h	Tue Jan  4 18:27:00 2011	(r216968)
@@ -217,9 +217,12 @@ struct tcp_info {
 	u_int32_t	tcpi_snd_nxt;		/* Next egress seqno */
 	u_int32_t	tcpi_rcv_nxt;		/* Next ingress seqno */
 	u_int32_t	tcpi_toe_tid;		/* HWTID for TOE endpoints */
+	u_int32_t	tcpi_snd_rexmitpack;	/* Retransmitted packets */
+	u_int32_t	tcpi_rcv_ooopack;	/* Out-of-order packets */
+	u_int32_t	tcpi_snd_zerowin;	/* Zero-sized windows sent */
 	
 	/* Padding to grow without breaking ABI. */
-	u_int32_t	__tcpi_pad[29];		/* Padding. */
+	u_int32_t	__tcpi_pad[26];		/* Padding. */
 };
 #endif
 

Modified: stable/8/sys/netinet/tcp_output.c
==============================================================================
--- stable/8/sys/netinet/tcp_output.c	Tue Jan  4 17:27:17 2011	(r216967)
+++ stable/8/sys/netinet/tcp_output.c	Tue Jan  4 18:27:00 2011	(r216968)
@@ -783,6 +783,7 @@ send:
 		if ((tp->t_flags & TF_FORCEDATA) && len == 1)
 			TCPSTAT_INC(tcps_sndprobe);
 		else if (SEQ_LT(tp->snd_nxt, tp->snd_max) || sack_rxmit) {
+			tp->t_sndrexmitpack++;
 			TCPSTAT_INC(tcps_sndrexmitpack);
 			TCPSTAT_ADD(tcps_sndrexmitbyte, len);
 		} else {
@@ -1007,9 +1008,10 @@ send:
 	 * to read more data than can be buffered prior to transmitting on
 	 * the connection.
 	 */
-	if (th->th_win == 0)
+	if (th->th_win == 0) {
+		tp->t_sndzerowin++;
 		tp->t_flags |= TF_RXWIN0SENT;
-	else
+	} else
 		tp->t_flags &= ~TF_RXWIN0SENT;
 	if (SEQ_GT(tp->snd_up, tp->snd_nxt)) {
 		th->th_urp = htons((u_short)(tp->snd_up - tp->snd_nxt));

Modified: stable/8/sys/netinet/tcp_reass.c
==============================================================================
--- stable/8/sys/netinet/tcp_reass.c	Tue Jan  4 17:27:17 2011	(r216967)
+++ stable/8/sys/netinet/tcp_reass.c	Tue Jan  4 18:27:00 2011	(r216968)
@@ -266,6 +266,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd
 			th->th_seq += i;
 		}
 	}
+ 	tp->t_rcvoopack++;
 	TCPSTAT_INC(tcps_rcvoopack);
 	TCPSTAT_ADD(tcps_rcvoobyte, *tlenp);
 

Modified: stable/8/sys/netinet/tcp_usrreq.c
==============================================================================
--- stable/8/sys/netinet/tcp_usrreq.c	Tue Jan  4 17:27:17 2011	(r216967)
+++ stable/8/sys/netinet/tcp_usrreq.c	Tue Jan  4 18:27:00 2011	(r216968)
@@ -1226,6 +1226,9 @@ tcp_fill_info(struct tcpcb *tp, struct t
 	ti->tcpi_rcv_mss = tp->t_maxseg;
 	if (tp->t_flags & TF_TOE)
 		ti->tcpi_options |= TCPI_OPT_TOE;
+	ti->tcpi_snd_rexmitpack = tp->t_sndrexmitpack;
+	ti->tcpi_rcv_ooopack = tp->t_rcvoopack;
+	ti->tcpi_snd_zerowin = tp->t_sndzerowin;
 }
 
 /*

Modified: stable/8/sys/netinet/tcp_var.h
==============================================================================
--- stable/8/sys/netinet/tcp_var.h	Tue Jan  4 17:27:17 2011	(r216967)
+++ stable/8/sys/netinet/tcp_var.h	Tue Jan  4 18:27:00 2011	(r216968)
@@ -177,6 +177,7 @@ struct tcpcb {
 	u_long	snd_cwnd_prev;		/* cwnd prior to retransmit */
 	u_long	snd_ssthresh_prev;	/* ssthresh prior to retransmit */
 	tcp_seq	snd_recover_prev;	/* snd_recover prior to retransmit */
+	int	t_sndzerowin;		/* zero-window updates sent */
 	u_int	t_badrxtwin;		/* window for retransmit recovery */
 	u_char	snd_limited;		/* segments limited transmitted */
 /* SACK related state */
@@ -193,6 +194,8 @@ struct tcpcb {
 	u_int32_t	rfbuf_ts;	/* recv buffer autoscaling timestamp */
 	int	rfbuf_cnt;		/* recv buffer autoscaling byte count */
 	struct toe_usrreqs *t_tu;	/* offload operations vector */
+	int	t_sndrexmitpack;	/* retransmit packets sent */
+	int	t_rcvoopack;		/* out-of-order packets received */
 	void	*t_toe;			/* TOE pcb pointer */
 	int	t_bytes_acked;		/* # bytes acked during current RTT */
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101041827.p04IR1Be050411>