Changeset 4659
 Timestamp:
 03/02/10 00:52:36 (6 years ago)
 Location:
 vic/branches/cc/cc
 Files:

 2 modified
Legend:
 Unmodified
 Added
 Removed

vic/branches/cc/cc/tfwc_sndr.cpp
r4658 r4659 119 119 tot_weight_ = 0.0; 120 120 121 timer_driven_ = false; 121 to_driven_ = false; 122 tcp_tick_ = 0.01; 123 srtt_init_ = 12; 124 rttvar_exp_ = 2; 125 t_srtt_ = int(srtt_init_/tcp_tick_) << T_SRTT_BITS; 126 t_rttvar_ = int(rttvar_init_/tcp_tick_) << T_RTTVAR_BITS; 122 127 } 123 128 … … 223 228 so_recv_, jacked_%TSZ, tsvec_[jacked_%TSZ], tao_, srtt_); 224 229 230 // is TFWC being driven by timeout mechanism? 231 if(to_driven_ && is_tfwc_on_) 232 new_rto(tao_); 233 225 234 // initialize variables for the next pkt reception 226 235 free(ackv_); … … 335 344 */ 336 345 void TfwcSndr::update_rtt(double rtt_sample) { 346 // calculate t0_ 347 t_rtt_ = int(rtt_sample/tcp_tick_ + .5); 348 if(t_rtt_ == 0) t_rtt_ = 1; 349 350 if(t_srtt_ != 0) { 351 register short rtt_delta; 352 rtt_delta = t_rtt_  (t_srtt_ >> T_SRTT_BITS); 353 354 if ((t_srtt_ += rtt_delta) <= 0) 355 t_srtt_ = 1; 356 357 if (rtt_delta < 0) 358 rtt_delta = rtt_delta; 359 360 rtt_delta = (t_rttvar_ >> T_RTTVAR_BITS); 361 if((t_rttvar_ += rtt_delta) <= 0) 362 t_rttvar_ = 1; 363 } 364 else { 365 t_srtt_ = t_rtt_ << T_SRTT_BITS; 366 t_rttvar_ = t_rtt_ << (T_RTTVAR_BITS1); 367 } 368 369 // finally, t0_ = (smoothed RTT) + 4 * (rtt variance) 370 t0_ = (((t_rttvar_ << (rttvar_exp_ + (T_SRTT_BITS  T_RTTVAR_BITS))) 371 + t_srtt_) >> T_SRTT_BITS ) * tcp_tick_; 372 373 if (t0_ < minrto_) 374 t0_ = minrto_; 337 375 338 376 // calculate smoothed RTT … … 349 387 350 388 // update the current RTO 351 if (k_ * rttvar_ > g_) 389 if(!to_driven_) { 390 if (k_ * rttvar_ > g_) 352 391 rto_ = srtt_ + k_ * rttvar_; 353 else392 else 354 393 rto_ = srtt_ + g_; 394 } 355 395 356 396 // 'rto' could be rounded by 'maxrto' … … 377 417 378 418 // TFWC congestion window 379 t_win_ = 1 / f_p_; 380 419 t_win_ = 1. / f_p_; 381 420 cwnd_ = (int) (t_win_ + .5); 421 422 // timeout driven when cwnd is less than 2 423 if (t_win_ < 2.) 424 to_driven_ = true; 425 else 426 to_driven_ = false; 382 427 383 428 // cwnd should always be greater than 1 … … 587 632 void TfwcSndr::expire(int option) { 588 633 if (option == TFWC_TIMER_RTX) { 589 if(!t imer_driven_)634 if(!to_driven_) 590 635 reset_rtx_timer(1); 591 636 else 592 637 reset_rtx_timer(0); 593 638 594 // TBA  need to add send method here 639 // artificially inflate the latest ack 640 if(!to_driven_) 641 jacked_++; 642 643 // trigger packet sending 644 tx_>cc_tfwc_output(); 595 645 } 596 646 } … … 624 674 rtx_timer_ > resched(rto_ * 1000.); 625 675 } 676 677 /* 678 * new RTO calculation 679 */ 680 void TfwcSndr::new_rto(double rtt) { 681 double tmp1 = 3. * sqrt(p_ * 3./8.); 682 double tmp2 = t0_ * p_ * (1. + 32. * pow(p_, 2.)); 683 684 if(tmp1 > 1.) 685 tmp1 = 1.; 686 687 double term1 = rtt * sqrt(p_ * 2./3.); 688 double term2 = tmp1 * tmp2; 689 690 rto_ = (term1 + term2) * sqrt(rtt)/sqrtrtt_; 691 } 
vic/branches/cc/cc/tfwc_sndr.h
r4658 r4659 50 50 #endif 51 51 52 #define T_RTTVAR_BITS 2 // XXX not used53 #define T_SRTT_BITS 3 // XXX not used52 #define T_RTTVAR_BITS 2 53 #define T_SRTT_BITS 3 54 54 55 55 #define BITLEN 16 … … 60 60 61 61 class TfwcSndr; 62 class Transmitter; 62 63 63 64 // retransmission timer … … 191 192 double tao_; // sampled RTT 192 193 194 Transmitter *tx_; 195 193 196 private: 194 197 // update RTT … … 219 222 // dupack action 220 223 void dupack_action(); 224 225 // new RTO 226 void new_rto(double rtt); 221 227 222 228 // AckVec clone from Vic … … 283 289 double tot_weight_; // total weight 284 290 int hsz_; // current history size 285 bool t imer_driven_; // is TFWC being driven by timerout?291 bool to_driven_; // is TFWC being driven by timerout? 286 292 287 293 // RTT related variables … … 291 297 double minrto_; // min RTO allowed 292 298 double maxrto_; // max RTO 293 double alpha_; // smoothing factor for RTT/RTO calculation294 double beta_; // smoothing factor for RTT/RTO calculation295 double g_; // timer granularity296 int k_; // k value297 double t0_; // t0 value at TCP throughput equation298 299 double df_; // decay factor 299 300 double sqrtrtt_; // the mean of the sqrt of RTT … … 307 308 int num_elm_; // number of ackvec elements 308 309 int num_vec_; // numver of ackvec chunks 310 311 // TCP's RTO calculation 312 double alpha_; // smoothing factor for RTT/RTO calculation 313 double beta_; // smoothing factor for RTT/RTO calculation 314 double g_; // timer granularity 315 int k_; // k value 316 int t_rtt_; // RTT 317 int t_rttvar_; // RTT variance 318 int t_srtt_; // smoothed RTT 319 int srtt_init_; // initial val for t_srtt_ 320 int rttvar_init_; // initial val for t_rttvar_ 321 int rttvar_exp_; // exponent of multiple for t0_ 322 double t0_; // t0 value at TCP throughput equation 323 double tcp_tick_; 309 324 }; 310 325