summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_output.c
diff options
context:
space:
mode:
authorps <ps@FreeBSD.org>2005-05-11 21:37:42 +0000
committerps <ps@FreeBSD.org>2005-05-11 21:37:42 +0000
commit0ee231720168f91505019116179aa59a3f939618 (patch)
tree136eaa5e8df38eb44a216776b146e7f2be9d17d5 /sys/netinet/tcp_output.c
parentb2be2c6b08ec2d5c2b4b24ddd94f0f026c865ff9 (diff)
downloadFreeBSD-src-0ee231720168f91505019116179aa59a3f939618.zip
FreeBSD-src-0ee231720168f91505019116179aa59a3f939618.tar.gz
When looking for the next hole to retransmit from the scoreboard,
or to compute the total retransmitted bytes in this sack recovery episode, the scoreboard is traversed. While in sack recovery, this traversal occurs on every call to tcp_output(), every dupack and every partial ack. The scoreboard could potentially get quite large, making this traversal expensive. This change optimizes this by storing hints (for the next hole to retransmit and the total retransmitted bytes in this sack recovery episode) reducing the complexity to find these values from O(n) to constant time. The debug code that sanity checks the hints against the computed value will be removed eventually. Submitted by: Mohan Srinivasan, Noritoshi Demizu, Raja Mukerji.
Diffstat (limited to 'sys/netinet/tcp_output.c')
-rw-r--r--sys/netinet/tcp_output.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index c6ce9e2..783a00f 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -863,6 +863,7 @@ send:
} else {
th->th_seq = htonl(p->rxmit);
p->rxmit += len;
+ tp->sackhint.sack_bytes_rexmit += len;
}
th->th_ack = htonl(tp->rcv_nxt);
if (optlen) {
@@ -1091,9 +1092,13 @@ timer:
* the TF_SENTFIN flag handles that case.
*/
if ((flags & TH_SYN) == 0) {
- if (sack_rxmit)
+ if (sack_rxmit) {
p->rxmit -= len;
- else
+ tp->sackhint.sack_bytes_rexmit -= len;
+ KASSERT(tp->sackhint.sack_bytes_rexmit
+ >= 0,
+ ("sackhint bytes rtx >= 0"));
+ } else
tp->snd_nxt -= len;
}
}
OpenPOWER on IntegriCloud