Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet Fix the bug in the tcp transmit prediction code.
details: https://anonhg.NetBSD.org/src/rev/373f202e188a
branches: trunk
changeset: 554018:373f202e188a
user: ragge <ragge%NetBSD.org@localhost>
date: Fri Oct 24 10:25:40 2003 +0000
description:
Fix the bug in the tcp transmit prediction code.
During testing the prediction counters show a hit-rate on about 85% for
packets sent on a local LAN, and better than 99% for intercontinental
high-speed bulk traffic (!).
diffstat:
sys/netinet/tcp_input.c | 29 ++++++++---------------------
sys/netinet/tcp_output.c | 7 ++++---
2 files changed, 12 insertions(+), 24 deletions(-)
diffs (94 lines):
diff -r 8f0e8d2e1e94 -r 373f202e188a sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c Fri Oct 24 10:25:08 2003 +0000
+++ b/sys/netinet/tcp_input.c Fri Oct 24 10:25:40 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_input.c,v 1.185 2003/10/23 20:55:08 mycroft Exp $ */
+/* $NetBSD: tcp_input.c,v 1.186 2003/10/24 10:25:40 ragge Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.185 2003/10/23 20:55:08 mycroft Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.186 2003/10/24 10:25:40 ragge Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -1476,8 +1476,6 @@
SEQ_LEQ(th->th_ack, tp->snd_max) &&
tp->snd_cwnd >= tp->snd_wnd &&
tp->t_dupacks < tcprexmtthresh) {
- int slen;
-
/*
* this is a pure ack for outstanding data.
*/
@@ -1494,14 +1492,10 @@
tcpstat.tcps_rcvackbyte += acked;
ND6_HINT(tp);
- slen = tp->t_lastm->m_len;
+ if (acked > (tp->t_lastoff - tp->t_inoff))
+ tp->t_lastm = NULL;
sbdrop(&so->so_snd, acked);
- if (so->so_snd.sb_cc != 0) {
- tp->t_lastoff -= acked;
- if (tp->t_lastm->m_len < slen)
- tp->t_inoff -=
- (slen - tp->t_lastm->m_len);
- }
+ tp->t_lastoff -= acked;
/*
* We want snd_recover to track snd_una to
@@ -2118,17 +2112,10 @@
sbdrop(&so->so_snd, (int)so->so_snd.sb_cc);
ourfinisacked = 1;
} else {
- int slen;
-
- slen = tp->t_lastm->m_len;
+ if (acked > (tp->t_lastoff - tp->t_inoff))
+ tp->t_lastm = NULL;
sbdrop(&so->so_snd, acked);
- tp->snd_wnd -= acked;
- if (so->so_snd.sb_cc != 0) {
- tp->t_lastoff -= acked;
- if (tp->t_lastm->m_len != slen)
- tp->t_inoff -=
- (slen - tp->t_lastm->m_len);
- }
+ tp->t_lastoff -= acked;
ourfinisacked = 0;
}
sowwakeup(so);
diff -r 8f0e8d2e1e94 -r 373f202e188a sys/netinet/tcp_output.c
--- a/sys/netinet/tcp_output.c Fri Oct 24 10:25:08 2003 +0000
+++ b/sys/netinet/tcp_output.c Fri Oct 24 10:25:40 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_output.c,v 1.104 2003/10/24 03:12:53 enami Exp $ */
+/* $NetBSD: tcp_output.c,v 1.105 2003/10/24 10:25:40 ragge Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -138,7 +138,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.104 2003/10/24 03:12:53 enami Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.105 2003/10/24 10:25:40 ragge Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -451,7 +451,8 @@
*/
if (
#ifdef FAST_MBSEARCH
- off == 0 || (tp->t_lastoff + tp->t_lastlen) != off
+ off == 0 || tp->t_lastm == NULL ||
+ (tp->t_lastoff + tp->t_lastlen) != off
#else
1
#endif
Home |
Main Index |
Thread Index |
Old Index