diff -buN ns-2.1b8/scoreboard.h myns/scoreboard.h --- ns-2.1b8/scoreboard.h Sat Jul 22 20:29:33 2000 +++ myns/scoreboard.h Thu May 10 22:51:59 2001 @@ -39,7 +39,9 @@ // Definition of the scoreboard class: -#define SBSIZE 1024 +// modified to a larger value by Liang Guo 2001/05/10, +//#define SBSIZE 1024 +#define SBSIZE 2048 #include "tcp.h" diff -buN ns-2.1b8/tcp-newreno.cc myns/tcp-newreno.cc --- ns-2.1b8/tcp-newreno.cc Tue May 29 19:11:04 2001 +++ myns/tcp-newreno.cc Mon Jan 28 18:44:42 2002 @@ -54,21 +54,6 @@ bind("partial_window_deflation_", &partial_window_deflation_); } +/* added by Liang Guo, have to reset acked_ */ +void NewRenoTcpAgent::reset() +{ + acked_ = 0; + + return (RenoTcpAgent::reset()); +} + /* * Process a packet that acks previously unacknowleges data, but * does not take us out of Fast Retransmit. diff -buN ns-2.1b8/tcp-reno.cc myns/tcp-reno.cc --- ns-2.1b8/tcp-reno.cc Tue May 29 19:11:04 2001 +++ myns/tcp-reno.cc Mon Jan 28 18:44:42 2002 @@ -39,21 +39,6 @@ } } class_reno; +/* added by Liang Guo, 12/19/2000, have to reset dupwnd_ as well */ +void RenoTcpAgent::reset() +{ + dupwnd_ = 0; + + return(TcpAgent::reset()); +} + int RenoTcpAgent::window() { // diff -buN ns-2.1b8/tcp.cc myns/tcp.cc --- ns-2.1b8/tcp.cc Tue May 29 19:11:04 2001 +++ myns/tcp.cc Mon Jan 28 18:44:42 2002 @@ -34,7 +34,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /nfs/jade/vint/CVSROOT/ns-2/tcp.cc,v 1.123 2001/05/29 23:11:04 haldar Exp $ (LBL)"; + "@(#) $Header: /nfs/jade/vint/CVSROOT/ns-2/tcp.cc,v 1.126 2001/11/27 22:40:20 sfloyd Exp $ (LBL)"; #endif #include @@ -68,11 +68,13 @@ t_backoff_(0), ts_peer_(0), rtx_timer_(this), delsnd_timer_(this), burstsnd_timer_(this), + /* added by Liang Guo, 12/20/2000, polynomial control */ + w_zero_(1), dupacks_(0), curseq_(0), highest_ack_(0), cwnd_(0), ssthresh_(0), count_(0), fcnt_(0), rtt_active_(0), rtt_seq_(-1), rtt_ts_(0.0), maxseq_(0), cong_action_(0), ecn_burst_(0), ecn_backoff_(0), @@ -419,6 +427,54 @@ reset_qoption(); } } + + /* added by Liang Guo, 12/20/2000, polynomial controls */ + w_zero_ = 1; + } /* * Initialize variables for the retransmit timer. @@ -832,6 +910,42 @@ cwnd_ += increase_num_ / (cwnd_*pow(cwnd_,k_parameter_)); break; + case 7: + /* polynomial controls */ + { + double alpha, beta, delta; + double w_t = cwnd_; + if (k_parameter_ == 2) { + alpha = 3.0 * sqrt(decrease_num_ * (1.0 - decrease_num_)) / (1 - 2*(1.0 - decrease_num_)/3.0); + delta = alpha * sqrt(w_t/w_zero_ - 1) / w_t; + + + if (w_t - w_zero_ < 0.00001) + cwnd_ += (alpha * alpha * 0.25 / w_zero_) / w_t; + else + cwnd_ += delta/1.414; /* 1.414 = Sqrt(Gamma(2.0) */ + } + if (k_parameter_ == 1.5) { + beta = 1 - decrease_num_; + alpha = 2.25 * pow(beta * beta * (1-beta), 1.0/3)/ ( 1 - 0.6 * beta); + delta = (alpha * pow(w_t/w_zero_ - 1, 1.0/3)) / w_t; + + if (w_t - w_zero_ < 0.00001) + cwnd_ += (alpha * alpha * 0.25 / w_zero_) / w_t; + else + cwnd_ += delta/1.153; /* 1.153 = Sqrt(Gamma(1.5)) */ + } + if (k_parameter_ == 1) + /* GAIMD */ + cwnd_ += 3.0 * (1-decrease_num_)/(1+decrease_num_) / w_t; + } + break; + + case 9: + /* AIAD controls */ + cwnd_ += 3.0 * (1.0 - decrease_num_) / ((2.0*w_zero_ + 1 - decrease_num_) * cwnd_); + break; + default: #ifdef notdef /*XXX*/ @@ -863,6 +975,11 @@ if (wnd_option_ == 6) { /* binomial controls */ decreasewin = windowd() - (1.0-decrease_num_)*pow(windowd(),l_parameter_); + } else if (wnd_option_ == 7) { + /* added by Liang Guo, 12/20/2000, polynomial controls */ + decreasewin = decrease_num_ * windowd(); + } else if (wnd_option_ == 8) { + decreasewin = windowd() - (1.0-decrease_num_); } else decreasewin = decrease_num_ * windowd(); win = windowd(); @@ -873,6 +990,11 @@ if (wnd_option_ == 6) { /* binomial controls */ temp = (int)(window() - (1.0-decrease_num_)*pow(window(),l_parameter_)); + } else if (wnd_option_ == 7) { + /* added by Liang Guo, 12/20/2000, polynomial controls */ + temp = (int)(decrease_num_ * window()); + } else if (wnd_option_ == 8) { + temp = (int)(window() - (1.0-decrease_num_)); } else temp = (int)(decrease_num_ * window()); decreasewin = (double) temp; @@ -892,12 +1014,17 @@ else if (how & THREE_QUARTER_SSTHRESH) if (ssthresh_ < 3*cwnd_/4) ssthresh_ = (int)(3*cwnd_/4); - if (how & CLOSE_CWND_HALF) + if (how & CLOSE_CWND_HALF) { // For the first decrease, decrease by half // even for non-standard values of decrease_num_. if (first_decrease_ == 1 || slowstart || decrease_num_ == 0.5) { cwnd_ = halfwin; } else cwnd_ = decreasewin; + + // added by Liang Guo 2001/03/31, cwnd shouldn't be smaller than 1 + if (cwnd_ < 1) + cwnd_ = 1; + } else if (how & CWND_HALF_WITH_MIN) { // We have not thought about how non-standard TCPs, with // non-standard values of decrease_num_, should respond @@ -920,6 +1047,12 @@ } if (ssthresh_ < 2) ssthresh_ = 2; + /* added by Liang Guo, 12/20/2000 */ + if (cwnd_ < ssthresh_) + w_zero_ = ssthresh_; + else + w_zero_ = cwnd_; + if (how & (CLOSE_CWND_HALF|CLOSE_CWND_RESTART|CLOSE_CWND_INIT|CLOSE_CWND_ONE)) cong_action_ = TRUE; diff -buN ns-2.1b8/tcp.h myns/tcp.h --- ns-2.1b8/tcp.h Mon May 21 15:27:32 2001 +++ myns/tcp.h Fri Dec 7 17:03:10 2001 @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#) $Header: /nfs/jade/vint/CVSROOT/ns-2/tcp.h,v 1.88 2001/05/21 19:27:32 haldar Exp $ (LBL) + * @(#) $Header: /nfs/jade/vint/CVSROOT/ns-2/tcp.h,v 1.91 2001/11/27 22:40:20 sfloyd Exp $ (LBL) */ #ifndef ns_tcp_h #define ns_tcp_h @@ -263,6 +267,8 @@ * old ECN implementation, which never * reduced the congestion window below * one packet. */ + /* added by Liang Guo, 12/20/2000, used for polynomial control */ + double w_zero_; /* window size at the begining of the cycle */ FILE *plotfile_; /* * Dynamic state. @@ -356,6 +364,9 @@ class RenoTcpAgent : public virtual TcpAgent { public: RenoTcpAgent(); + /* added by Liang Guo 2000/12/19, need to update ndup as well */ + void reset(); virtual int window(); virtual double windowd(); virtual void recv(Packet *pkt, Handler*); @@ -370,6 +381,9 @@ class NewRenoTcpAgent : public virtual RenoTcpAgent { public: NewRenoTcpAgent(); + /* added by Liang Guo 2000/12/19, need to reset ndup */ + void reset(); virtual void recv(Packet *pkt, Handler*); virtual void partialnewack_helper(Packet* pkt); virtual void dupack_action();