summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorgnn <gnn@FreeBSD.org>2010-11-17 18:55:12 +0000
committergnn <gnn@FreeBSD.org>2010-11-17 18:55:12 +0000
commit67b3b6b168c800611c4683cb81384e4a678517c6 (patch)
treec215fe6cad187e004f1c275a1854ec9306dfb042 /sys/netinet
parentfa6fd32fc398ffee50fe04ddd692ad76c71ebfbf (diff)
downloadFreeBSD-src-67b3b6b168c800611c4683cb81384e4a678517c6.zip
FreeBSD-src-67b3b6b168c800611c4683cb81384e4a678517c6.tar.gz
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). MFC after: 2 weeks
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/tcp.h5
-rw-r--r--sys/netinet/tcp_output.c6
-rw-r--r--sys/netinet/tcp_reass.c1
-rw-r--r--sys/netinet/tcp_usrreq.c3
-rw-r--r--sys/netinet/tcp_var.h3
5 files changed, 15 insertions, 3 deletions
diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h
index 62a89f7..443425f 100644
--- a/sys/netinet/tcp.h
+++ b/sys/netinet/tcp.h
@@ -225,9 +225,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
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index 7db0adb..bf42dac 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -803,6 +803,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 {
@@ -1027,9 +1028,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));
diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c
index 1d840cd..d430991 100644
--- a/sys/netinet/tcp_reass.c
+++ b/sys/netinet/tcp_reass.c
@@ -266,6 +266,7 @@ tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m)
th->th_seq += i;
}
}
+ tp->t_rcvoopack++;
TCPSTAT_INC(tcps_rcvoopack);
TCPSTAT_ADD(tcps_rcvoobyte, *tlenp);
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index a28ddef..a2231ba 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1218,6 +1218,9 @@ tcp_fill_info(struct tcpcb *tp, struct tcp_info *ti)
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;
}
/*
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index 7b38667..a37d306 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -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 */
struct cc_algo *cc_algo; /* congestion control algorithm */
OpenPOWER on IntegriCloud