Changeset 4789
- Timestamp:
- 04/29/10 16:31:39 (3 years ago)
- Location:
- vic/branches/cc
- Files:
-
- 5 modified
-
cc/tfwc_sndr.cpp (modified) (6 diffs)
-
cc/tfwc_sndr.h (modified) (4 diffs)
-
rtp/session.cpp (modified) (1 diff)
-
rtp/transmitter.cpp (modified) (3 diffs)
-
rtp/transmitter.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vic/branches/cc/cc/tfwc_sndr.cpp
r4787 r4789 61 61 TfwcSndr::TfwcSndr() : 62 62 seqno_(0), 63 cwnd_(1), 63 cwnd_(1), // initial cwnd in packet 64 bcwnd_(1500), // initial cwnd in byte 64 65 rtx_timer_(this), 65 66 aoa_(0), … … 147 148 asize_ = 0; 148 149 pcnt_ = 0; 149 psize_ = 0;150 psize_ = 1000;// initial EWMA estimated packet size 150 151 lambda1_ = .75; 151 152 lambda2_ = .15; … … 161 162 seqno_ = ntohs(rh->rh_seqno); 162 163 now_ = now; 163 // number of bytes for this packet164 record_[seqno_%PSR] = pb->len;165 //print_psize(now_, record_[seqno_%PSR]);166 164 167 165 // arithmetic average packet size (per frame) … … 180 178 asize_ = 0; pcnt_ = 0; 181 179 } 180 // number of the actual bytes for this packet 181 //record_[seqno_%PSR] = pb->len; 182 // number of *estimated* bytes for this packet 183 record_[seqno_%PSR] = psize_; 182 184 //print_psize(now_, psize_, pb->len); 183 185 … … 395 397 else 396 398 cwnd_in_packets(revert); 397 } 398 399 /* 400 * TFWC congestion window in bytes 401 */ 402 void TfwcSndr::window_in_bytes(bool revert) { 403 // TFWC is not turned on (i.e., no packet loss yet) 404 if(!is_tfwc_on_) 405 tcp_like_increase(); 406 // TFWC is turned on, so compute congestion window 407 else 408 cwnd_in_bytes(revert); 399 400 // finally, cwnd in bytes 401 window_in_bytes(); 409 402 } 410 403 … … 626 619 if (cwnd_ < 1) 627 620 cwnd_ = 1; 628 }629 630 /*631 * core part for congestion window control632 * (cwnd is in bytes)633 */634 void TfwcSndr::cwnd_in_bytes(bool revert) {635 if(!revert) {636 loss_history();637 avg_loss_interval();638 }639 621 } 640 622 -
vic/branches/cc/cc/tfwc_sndr.h
r4787 r4789 97 97 inline u_int16_t tfwc_sndr_get_aoa() { return aoa_; } 98 98 99 // return just acked seqno99 // just acked seqno in packets and in bytes 100 100 inline u_int16_t tfwc_sndr_jacked() { return jacked_; } 101 102 // return tfwc controlled cwnd value 103 inline u_int32_t tfwc_magic() { return cwnd_; }; 101 inline int tfwc_sndr_bjacked() { return record_[bjacked_%PSR]; } 102 103 // tfwc controlled cwnd value in packets and in bytes 104 inline u_int32_t tfwc_magic() { return cwnd_; } 105 inline int tfwc_bmagic() { return bcwnd_; } 104 106 105 107 // set timestamp in double type (TfwcSndr) … … 116 118 u_int16_t seqno_; // packet sequence number 117 119 u_int32_t cwnd_; // congestion window 120 int bcwnd_; // congestion window in bytes 121 int bjacked_; // just ack'd in bytes 118 122 119 123 // Rtx timer … … 198 202 void cwnd_in_packets(bool revert); 199 203 // TFWC congestion window in bytes 200 void window_in_bytes(bool revert); 201 void cwnd_in_bytes(bool revert); 204 inline void window_in_bytes() { 205 bcwnd_ = psize_ * cwnd_; 206 } 202 207 203 208 // calcuate average loss interval … … 374 379 } 375 380 376 // print packet size381 // print the actual packet size and EWMA estimated one 377 382 inline void print_psize(double now, int size, int len) { 378 fprintf(stderr, "\tnow: %f psize: %d real: %d\n", now, size, len);383 fprintf(stderr, "\tnow: %f psize: %d actual: %d\n", now, size, len); 379 384 } 380 385 -
vic/branches/cc/rtp/session.cpp
r4766 r4789 727 727 } 728 728 //fprintf(stderr, "...........%s +%d\n",__FILE__,__LINE__); 729 break;729 break; 730 730 731 731 case RBCC: -
vic/branches/cc/rtp/transmitter.cpp
r4767 r4789 97 97 is_cc_active_(1), 98 98 is_buf_empty_(1), 99 cc_type_(WBCC) 99 cc_type_(WBCC), 100 cwnd_mode_(BYM) 100 101 { 101 102 memset((char*)&mh_, 0, sizeof(mh_)); … … 318 319 { 319 320 //cc_output_banner_top(); 320 // pb is not null, hence parse it.321 rtphdr* rh = (rtphdr *) pb->data;322 323 int magic = (int) tfwc_magic();324 //debug_msg("cwnd: %d\n", magic);325 int jack = (int) tfwc_sndr_jacked();326 //debug_msg("jack: %d\n", jack);327 321 328 if (ntohs(rh->rh_seqno) <= magic + jack) { 329 // move head pointer 330 head_ = pb->next; 331 // call Transmitter::output_data_only w/ XR reception 332 output_data_only(pb, XR_RECV); 333 } 322 // byte mode? or packet mode? 323 switch (cwnd_mode_) { 324 case BYM: 325 { 326 int len = 0; 327 if(pb->len < tfwc_bmagic() - len) { 328 len = pb->len; 329 // move head pointer 330 head_ = pb->next; 331 // call Transmitter::output_data_only w/ XR reception 332 output_data_only(pb, XR_RECV); 333 } 334 } 335 break; 336 case PKM: 337 { 338 // pb is not null, hence parse it. 339 rtphdr* rh = (rtphdr *) pb->data; 340 341 if (ntohs(rh->rh_seqno) <= tfwc_magic() + tfwc_sndr_jacked()) { 342 //debug_msg("cwnd: %d\n", tfwc_magic()); 343 //debug_msg("jack: %d\n", tfwc_sndr_jacked()); 344 345 // move head pointer 346 head_ = pb->next; 347 // call Transmitter::output_data_only w/ XR reception 348 output_data_only(pb, XR_RECV); 349 } 350 } 351 break; 352 } // switch (cwnd_mode_) 334 353 //cc_output_banner_bottom(); 335 354 } … … 353 372 } 354 373 355 // pb is not null, hence parse it. 356 rtphdr* rh = (rtphdr *) pb->data; 357 358 // cwnd value 359 int magic = (int) tfwc_magic(); 360 // debug_msg("cwnd: %d\n", magic); 361 362 // just acked seqno 363 int jack = (int) tfwc_sndr_jacked(); 364 // debug_msg("jack: %d\n", jack); 365 366 //fprintf(stderr, "\tXXX now: %f\tnum: %d\tcwnd: %d\tjack: %d\n", 367 //tx_get_now(), ntohs(rh->rh_seqno), magic, jack); 368 369 // while packet seqno is within "cwnd + jack", send that packet 370 while (ntohs(rh->rh_seqno) <= magic + jack) { 371 // move head pointer 372 head_ = pb->next; 373 // call Transmitter::output(pb) 374 output(pb, recv_by_ch); 375 376 // if the moved head pointer is not null, parse packet buffer. 377 // otherwise, break while statement. 378 if (head_ != 0) { 379 pb = head_; 380 rh = (rtphdr *) pb->data; 381 } else { 382 break; 383 } 384 } // end while () 374 // byte mode? or packet mode? 375 switch (cwnd_mode_) { 376 case BYM: 377 { 378 int len = 0; 379 while(pb->len < tfwc_bmagic() - len) { 380 len = pb->len; 381 // move head pointer 382 head_ = pb->next; 383 // call Transmitter::output(pb) 384 output(pb, XR_RECV); 385 386 if (head_ != 0) 387 pb = head_; 388 else 389 break; 390 } 391 } 392 break; 393 case PKM: 394 { 395 // pb is not null, hence parse it. 396 rtphdr* rh = (rtphdr *) pb->data; 397 398 // while packet seqno is within "cwnd + jack", send that packet 399 while (ntohs(rh->rh_seqno) <= tfwc_magic() + tfwc_sndr_jacked()) { 400 //debug_msg("cwnd: %d\n", tfwc_magic()); 401 //debug_msg("jack: %d\n", tfwc_sndr_jacked()); 402 403 // move head pointer 404 head_ = pb->next; 405 // call Transmitter::output(pb) 406 output(pb, recv_by_ch); 407 408 // if the moved head pointer is not null, parse packet buffer. 409 // otherwise, break while statement. 410 if (head_ != 0) { 411 pb = head_; 412 rh = (rtphdr *) pb->data; 413 } else { 414 break; 415 } 416 } // end while () 417 } 418 break; 419 } // switch (cwnd_mode_) 385 420 //cc_output_banner_bottom(); 386 421 } -
vic/branches/cc/rtp/transmitter.h
r4730 r4789 56 56 #define WBCC 101 57 57 #define RBCC 102 58 59 // cwnd mode 60 #define PKM 1 // PacKet Mode 61 #define BYM 2 // BYtes Mode 58 62 59 63 /* … … 151 155 bool is_buf_empty_; /* is pktbuf empty? */ 152 156 int cc_type_; 157 int cwnd_mode_; /* byte-mode? or packet-mode */ 153 158 int epc_; /* experimental packet counter */ 154 159
