svn commit: r196083 - projects/tcp_ffcaia2008_8.x/sys/netinet
Lawrence Stewart
lstewart at FreeBSD.org
Thu Aug 6 17:34:16 UTC 2009
Author: lstewart
Date: Thu Aug 6 17:34:15 2009
New Revision: 196083
URL: http://svn.freebsd.org/changeset/base/196083
Log:
Keep a sender-side tally of the total number of bytes outstanding at the
receiver when SACK is in use. This allows us to *accurately* gauge how much of
the outstanding window of data is actually sitting in the receiver's buffers.
This in turn will be used by follow up work to improve fast recovery performance
for SACK enabled connections.
Sponsored by: FreeBSD Foundation
Modified:
projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_input.c
projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_sack.c
projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_var.h
Modified: projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_input.c
==============================================================================
--- projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_input.c Thu Aug 6 09:07:07 2009 (r196082)
+++ projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_input.c Thu Aug 6 17:34:15 2009 (r196083)
@@ -2073,8 +2073,8 @@ tcp_do_segment(struct mbuf *m, struct tc
/*
* Compute the amount of data in flight first.
- * We can inject new data into the pipe iff
- * we have less than 1/2 the original window's
+ * We can inject new data into the pipe iff
+ * we have less than 1/2 the original window's
* worth of data in flight.
*/
awnd = (tp->snd_nxt - tp->snd_fack) +
Modified: projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_sack.c
==============================================================================
--- projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_sack.c Thu Aug 6 09:07:07 2009 (r196082)
+++ projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_sack.c Thu Aug 6 17:34:15 2009 (r196083)
@@ -316,6 +316,8 @@ tcp_sackhole_insert(struct tcpcb *tp, tc
else
TAILQ_INSERT_TAIL(&tp->snd_holes, hole, scblink);
+ tp->sack_hole_bytes += hole->end - hole->start;
+
/* Update SACK hint. */
if (tp->sack_nexthole == NULL)
tp->sack_nexthole = hole;
@@ -337,8 +339,22 @@ tcp_sackhole_remove(struct tcpcb *tp, st
/* Remove this SACK hole. */
TAILQ_REMOVE(&tp->snd_holes, hole, scblink);
+ tp->sack_hole_bytes -= hole->end - hole->start;
+
/* Free this SACK hole. */
tcp_sackhole_free(tp, hole);
+
+ /*
+#ifdef INVARIANTS
+ if (TAILQ_EMPTY(&tp->snd_holes))
+ KASSERT(tp->sack_hole_bytes == 0,
+ ("tp->sack_hole_bytes is %d instead of 0", tp->sack_hole_bytes));
+#endif
+ */
+ if (TAILQ_EMPTY(&tp->snd_holes) && tp->sack_hole_bytes != 0) {
+ printf("tp->sack_hole_bytes is %d instead of 0", tp->sack_hole_bytes);
+ tp->sack_hole_bytes = 0;
+ }
}
/*
@@ -499,14 +515,16 @@ tcp_sack_doack(struct tcpcb *tp, struct
*/
continue;
} else {
- /* Move start of hole forward. */
+ /* Shrink hole: slide start of hole forward. */
+ tp->sack_hole_bytes -= sblkp->end - cur->start;
cur->start = sblkp->end;
cur->rxmit = SEQ_MAX(cur->rxmit, cur->start);
}
} else {
/* Data acks at least the end of hole. */
if (SEQ_GEQ(sblkp->end, cur->end)) {
- /* Move end of hole backward. */
+ /* Shrink hole: slide end of hole backward. */
+ tp->sack_hole_bytes -= sblkp->start - cur->end;
cur->end = sblkp->start;
cur->rxmit = SEQ_MIN(cur->rxmit, cur->end);
} else {
@@ -523,6 +541,20 @@ tcp_sack_doack(struct tcpcb *tp, struct
+= (temp->rxmit
- temp->start);
}
+ /*
+ * Adjust tp->sack_hole_bytes specially
+ * here because tcp_sackhole_insert
+ * adds bytes to the tally that were
+ * already accounted for. Undo the
+ * addition of cur->end-sblkp->end bytes
+ * and also adjust for number of bytes
+ * in the sack block i.e.
+ * sblkp->end-sblkp->start
+ */
+ tp->sack_hole_bytes -= cur->end -
+ sblkp->end -
+ sblkp->end +
+ sblkp->start;
cur->end = sblkp->start;
cur->rxmit = SEQ_MIN(cur->rxmit,
cur->end);
Modified: projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_var.h
==============================================================================
--- projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_var.h Thu Aug 6 09:07:07 2009 (r196082)
+++ projects/tcp_ffcaia2008_8.x/sys/netinet/tcp_var.h Thu Aug 6 17:34:15 2009 (r196083)
@@ -186,6 +186,8 @@ struct tcpcb {
episode starts at this seq number */
struct sackhole *sack_nexthole; /* next hole to rexmt */
int sack_bytes_rexmit; /* # bytes rexmt this RTT */
+ int sack_hole_bytes; /* # bytes not yet sacked by rcv'r
+ this recovery episode */
int t_rttlow; /* smallest observerved RTT */
u_int32_t rfbuf_ts; /* recv buffer autoscaling timestamp */
int rfbuf_cnt; /* recv buffer autoscaling byte count */
More information about the svn-src-projects
mailing list