Subject: CVS commit: src/sys/netinet
To: None <source-changes@NetBSD.org>
From: Charles M. Hannum <mycroft@netbsd.org>
List: source-changes
Date: 01/26/2005 21:49:27
Module Name:	src
Committed By:	mycroft
Date:		Wed Jan 26 21:49:27 UTC 2005

Modified Files:
	src/sys/netinet: tcp_input.c tcp_timer.c tcp_var.h

Log Message:
Fix two problems in our TCP stack:

1) If an echoed RFC 1323 time stamp appears to be later than the current time,
   ignore it and fall back to old-style RTT calculation.  This prevents ending
   up with a negative RTT and panicking later.

2) Fix NewReno.  This involves a few changes:

   a) Implement the send_high variable in RFC 2582.  Our implementation is
      subtly different; it is one *past* the last sequence number transmitted
      rather than being equal to it.  This simplifies some logic and makes
      the code smaller.  Additional logic was required to prevent sequence
      number wraparound problems; this is not mentioned in RFC 2582.

   b) Make sure we reset t_dupacks on new acks, but *not* on a partial ack.
      All of the new ack code is pushed out into tcp_newreno().  (Later this
      will probably be a pluggable function.)  Thus t_dupacks keeps track of
      whether we're in fast recovery all the time, with Reno or NewReno, which
      keeps some logic simpler.

   c) We do not need to update snd_recover when we're not in fast recovery.
      See tech-net for an explanation of this.

   d) In the gratuitous fast retransmit prevention case, do not send a packet.
      RFC 2582 specifically says that we should "do nothing".

   e) Do not inflate the congestion window on a partial ack.  (This is done by
      testing t_dupacks to see whether we're still in fast recovery.)

This brings the performance of NewReno back up to the same as Reno in a few
random test cases (e.g. transferring peer-to-peer over my wireless network).
I have not concocted a good test case for the behavior specific to NewReno.


To generate a diff of this commit:
cvs rdiff -r1.212 -r1.213 src/sys/netinet/tcp_input.c
cvs rdiff -r1.66 -r1.67 src/sys/netinet/tcp_timer.c
cvs rdiff -r1.115 -r1.116 src/sys/netinet/tcp_var.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.