diff options
| author | Jeffrey Hsu <hsu@FreeBSD.org> | 2003-04-01 21:16:46 +0000 |
|---|---|---|
| committer | Jeffrey Hsu <hsu@FreeBSD.org> | 2003-04-01 21:16:46 +0000 |
| commit | 48d2549c3e0d8784e23a776ef7292120d39fbdb7 (patch) | |
| tree | d1db58cdb3be35d65a49830dbd5e613ba0b52f95 | |
| parent | 711c2e1de26f7bf4f6bcc156855617a4bda663a7 (diff) | |
Notes
| -rw-r--r-- | sys/netinet/tcp_input.c | 24 | ||||
| -rw-r--r-- | sys/netinet/tcp_reass.c | 24 | ||||
| -rw-r--r-- | sys/netinet/tcp_var.h | 1 |
3 files changed, 43 insertions, 6 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 59e6627558d3..9105e8d6fe1c 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1762,19 +1762,37 @@ trimthenstep6: tp->snd_nxt = th->th_ack; tp->snd_cwnd = tp->t_maxseg; (void) tcp_output(tp); + KASSERT(tp->snd_limited <= 2, + ("tp->snd_limited too big")); tp->snd_cwnd = tp->snd_ssthresh + - tp->t_maxseg * tp->t_dupacks; + tp->t_maxseg * + (tp->t_dupacks - tp->snd_limited); if (SEQ_GT(onxt, tp->snd_nxt)) tp->snd_nxt = onxt; goto drop; } else if (tcp_do_rfc3042) { u_long oldcwnd = tp->snd_cwnd; + tcp_seq oldsndmax = tp->snd_max; + u_int sent; KASSERT(tp->t_dupacks == 1 || tp->t_dupacks == 2, ("dupacks not 1 or 2")); - tp->snd_cwnd += tp->t_dupacks * - tp->t_maxseg; + if (tp->t_dupacks == 1) { + tp->snd_limited = 0; + tp->snd_cwnd += tp->t_maxseg; + } else { + tp->snd_cwnd += + tp->t_maxseg * 2; + } (void) tcp_output(tp); + sent = tp->snd_max - oldsndmax; + if (sent > tp->t_maxseg) { + KASSERT(tp->snd_limited == 0 && + tp->t_dupacks == 2, + ("sent too much")); + tp->snd_limited = 2; + } else if (sent > 0) + ++tp->snd_limited; tp->snd_cwnd = oldcwnd; goto drop; } diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c index 59e6627558d3..9105e8d6fe1c 100644 --- a/sys/netinet/tcp_reass.c +++ b/sys/netinet/tcp_reass.c @@ -1762,19 +1762,37 @@ trimthenstep6: tp->snd_nxt = th->th_ack; tp->snd_cwnd = tp->t_maxseg; (void) tcp_output(tp); + KASSERT(tp->snd_limited <= 2, + ("tp->snd_limited too big")); tp->snd_cwnd = tp->snd_ssthresh + - tp->t_maxseg * tp->t_dupacks; + tp->t_maxseg * + (tp->t_dupacks - tp->snd_limited); if (SEQ_GT(onxt, tp->snd_nxt)) tp->snd_nxt = onxt; goto drop; } else if (tcp_do_rfc3042) { u_long oldcwnd = tp->snd_cwnd; + tcp_seq oldsndmax = tp->snd_max; + u_int sent; KASSERT(tp->t_dupacks == 1 || tp->t_dupacks == 2, ("dupacks not 1 or 2")); - tp->snd_cwnd += tp->t_dupacks * - tp->t_maxseg; + if (tp->t_dupacks == 1) { + tp->snd_limited = 0; + tp->snd_cwnd += tp->t_maxseg; + } else { + tp->snd_cwnd += + tp->t_maxseg * 2; + } (void) tcp_output(tp); + sent = tp->snd_max - oldsndmax; + if (sent > tp->t_maxseg) { + KASSERT(tp->snd_limited == 0 && + tp->t_dupacks == 2, + ("sent too much")); + tp->snd_limited = 2; + } else if (sent > 0) + ++tp->snd_limited; tp->snd_cwnd = oldcwnd; goto drop; } diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 18780d74c9d7..24247052f3ee 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -177,6 +177,7 @@ struct tcpcb { u_long snd_ssthresh_prev; /* ssthresh prior to retransmit */ tcp_seq snd_high_prev; /* snd_high prior to retransmit */ u_long t_badrxtwin; /* window for retransmit recovery */ + u_char snd_limited; /* segments limited transmitted */ }; /* |
