summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2005-04-05 20:27:36 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2005-04-05 20:27:36 +0000
commit1c426f1f218090a86478e6a9ab2db1bef88b1db7 (patch)
tree654a343090c994a4bab00987c1b8510ff7725efd /sys/netinet
parenta6a8b68db3ab80dbf876cb629fcb89f25ab77f2b (diff)
add tcp sack stats, similar to freebsd; ok deraadt
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/tcp_input.c5
-rw-r--r--sys/netinet/tcp_output.c5
-rw-r--r--sys/netinet/tcp_var.h8
3 files changed, 14 insertions, 4 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index a55e411ed12..cc46ff0fef4 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.185 2005/03/12 08:07:09 markus Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.186 2005/04/05 20:27:35 markus Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -1629,7 +1629,7 @@ trimthenstep6:
#if 1 /* TCP_ECN */
tcpstat.tcps_cwr_frecovery++;
#endif
- tcpstat.tcps_sndrexmitfast++;
+ tcpstat.tcps_sack_recovery_episode++;
#if defined(TCP_SACK) && defined(TCP_FACK)
tp->t_dupacks = tcprexmtthresh;
(void) tcp_output(tp);
@@ -2486,6 +2486,7 @@ tcp_sack_option(struct tcpcb *tp, struct tcphdr *th, u_char *cp, int optlen)
/* Note: TCPOLEN_SACK must be 2*sizeof(tcp_seq) */
tmp_cp = cp + 2;
tmp_olen = optlen - 2;
+ tcpstat.tcps_sack_rcv_opts++;
if (tp->snd_numholes < 0)
tp->snd_numholes = 0;
if (tp->t_maxseg == 0)
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index 97d3d1f5929..36aa624d0ba 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_output.c,v 1.75 2005/02/27 13:22:56 markus Exp $ */
+/* $OpenBSD: tcp_output.c,v 1.76 2005/04/05 20:27:35 markus Exp $ */
/* $NetBSD: tcp_output.c,v 1.16 1997/06/03 16:17:09 kml Exp $ */
/*
@@ -640,6 +640,7 @@ send:
int count = 0; /* actual number of SACKs inserted */
int maxsack = (MAX_TCPOPTLEN - (optlen + 4))/TCPOLEN_SACK;
+ tcpstat.tcps_sack_snd_opts++;
maxsack = min(maxsack, TCP_MAX_SACK);
for (i = 0; (i < tp->rcv_numsacks && count < maxsack); i++) {
struct sackblk sack = tp->sackblks[i];
@@ -817,6 +818,8 @@ send:
#if defined(TCP_SACK) && defined(TCP_FACK)
tp->retran_data += len;
#endif /* TCP_FACK */
+ tcpstat.tcps_sack_rexmits++;
+ tcpstat.tcps_sack_rexmit_bytes += len;
}
#endif /* TCP_SACK */
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index 43de48a8ec4..e91872a60f6 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_var.h,v 1.72 2005/03/09 11:14:38 markus Exp $ */
+/* $OpenBSD: tcp_var.h,v 1.73 2005/04/05 20:27:35 markus Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
@@ -445,6 +445,12 @@ struct tcpstat {
u_int64_t tcps_sc_retransmitted;/* # of retransmissions */
u_int64_t tcps_conndrained; /* # of connections drained */
+
+ u_int64_t tcps_sack_recovery_episode; /* SACK recovery episodes */
+ u_int64_t tcps_sack_rexmits; /* SACK rexmit segments */
+ u_int64_t tcps_sack_rexmit_bytes; /* SACK rexmit bytes */
+ u_int64_t tcps_sack_rcv_opts; /* SACK options received */
+ u_int64_t tcps_sack_snd_opts; /* SACK options sent */
};
/*