[Sumover-dev] [svn commit] r4789 - in vic/branches/cc: rtp
sumover-dev at cs.ucl.ac.uk
sumover-dev at cs.ucl.ac.uk
Thu Apr 29 16:31:39 BST 2010
Author: soohyunc
Date: Thu Apr 29 16:31:39 2010
New Revision: 4789
Modified:
vic/branches/cc/cc/tfwc_sndr.cpp
vic/branches/cc/cc/tfwc_sndr.h
vic/branches/cc/rtp/session.cpp
vic/branches/cc/rtp/transmitter.cpp
vic/branches/cc/rtp/transmitter.h
Log:
Vic can be controlled by TFWC in byte mode:
- cwnd operates in byte mode
- Vic sends more packets as long as cwnd(in bytes) allows
for TFWC part:
- initial cwnd in byte is set to 1500 (max MTU size)
- initial EWMA estimated packet size is set to 1000
(roughly equal to RTP pakcet buffer length)
Modified: vic/branches/cc/cc/tfwc_sndr.cpp
==============================================================================
--- vic/branches/cc/cc/tfwc_sndr.cpp (original)
+++ vic/branches/cc/cc/tfwc_sndr.cpp Thu Apr 29 16:31:39 2010
@@ -60,7 +60,8 @@
*/
TfwcSndr::TfwcSndr() :
seqno_(0),
- cwnd_(1),
+ cwnd_(1), // initial cwnd in packet
+ bcwnd_(1500), // initial cwnd in byte
rtx_timer_(this),
aoa_(0),
now_(0),
@@ -146,7 +147,7 @@
// EWMA packet size
asize_ = 0;
pcnt_ = 0;
- psize_ = 0;
+ psize_ = 1000;// initial EWMA estimated packet size
lambda1_ = .75;
lambda2_ = .15;
}
@@ -160,9 +161,6 @@
rtphdr* rh = (rtphdr *) pb->data;
seqno_ = ntohs(rh->rh_seqno);
now_ = now;
- // number of bytes for this packet
- record_[seqno_%PSR] = pb->len;
- //print_psize(now_, record_[seqno_%PSR]);
// arithmetic average packet size (per frame)
asize_ += pb->len;
@@ -179,6 +177,10 @@
asize_ = 0; pcnt_ = 0;
}
+ // number of the actual bytes for this packet
+ //record_[seqno_%PSR] = pb->len;
+ // number of *estimated* bytes for this packet
+ record_[seqno_%PSR] = psize_;
//print_psize(now_, psize_, pb->len);
// timestamp vector for loss history update
@@ -394,18 +396,9 @@
// TFWC is turned on, so compute congestion window
else
cwnd_in_packets(revert);
-}
-/*
- * TFWC congestion window in bytes
- */
-void TfwcSndr::window_in_bytes(bool revert) {
- // TFWC is not turned on (i.e., no packet loss yet)
- if(!is_tfwc_on_)
- tcp_like_increase();
- // TFWC is turned on, so compute congestion window
- else
- cwnd_in_bytes(revert);
+ // finally, cwnd in bytes
+ window_in_bytes();
}
/*
@@ -628,17 +621,6 @@
}
/*
- * core part for congestion window control
- * (cwnd is in bytes)
- */
-void TfwcSndr::cwnd_in_bytes(bool revert) {
- if(!revert) {
- loss_history();
- avg_loss_interval();
- }
-}
-
-/*
* generate weighting factors
*/
void TfwcSndr::gen_weight() {
Modified: vic/branches/cc/cc/tfwc_sndr.h
==============================================================================
--- vic/branches/cc/cc/tfwc_sndr.h (original)
+++ vic/branches/cc/cc/tfwc_sndr.h Thu Apr 29 16:31:39 2010
@@ -96,11 +96,13 @@
// return ackofack
inline u_int16_t tfwc_sndr_get_aoa() { return aoa_; }
- // return just acked seqno
+ // just acked seqno in packets and in bytes
inline u_int16_t tfwc_sndr_jacked() { return jacked_; }
+ inline int tfwc_sndr_bjacked() { return record_[bjacked_%PSR]; }
- // return tfwc controlled cwnd value
- inline u_int32_t tfwc_magic() { return cwnd_; };
+ // tfwc controlled cwnd value in packets and in bytes
+ inline u_int32_t tfwc_magic() { return cwnd_; }
+ inline int tfwc_bmagic() { return bcwnd_; }
// set timestamp in double type (TfwcSndr)
inline double tfwc_sndr_now() {
@@ -115,6 +117,8 @@
// variables
u_int16_t seqno_; // packet sequence number
u_int32_t cwnd_; // congestion window
+ int bcwnd_; // congestion window in bytes
+ int bjacked_; // just ack'd in bytes
// Rtx timer
void expire(int option);
@@ -197,8 +201,9 @@
void window_in_packets(bool revert);
void cwnd_in_packets(bool revert);
// TFWC congestion window in bytes
- void window_in_bytes(bool revert);
- void cwnd_in_bytes(bool revert);
+ inline void window_in_bytes() {
+ bcwnd_ = psize_ * cwnd_;
+ }
// calcuate average loss interval
void avg_loss_interval();
@@ -373,9 +378,9 @@
fprintf(stderr, " )\n");
}
- // print packet size
+ // print the actual packet size and EWMA estimated one
inline void print_psize(double now, int size, int len) {
- fprintf(stderr, "\tnow: %f psize: %d real: %d\n", now, size, len);
+ fprintf(stderr, "\tnow: %f psize: %d actual: %d\n", now, size, len);
}
int ndtp_; // number of data packet sent
Modified: vic/branches/cc/rtp/session.cpp
==============================================================================
--- vic/branches/cc/rtp/session.cpp (original)
+++ vic/branches/cc/rtp/session.cpp Thu Apr 29 16:31:39 2010
@@ -726,7 +726,7 @@
// fprintf(stderr, "[%d:%x] ", i, chunks[i]);
}
//fprintf(stderr, "...........%s +%d\n",__FILE__,__LINE__);
- break;
+ break;
case RBCC:
break;
Modified: vic/branches/cc/rtp/transmitter.cpp
==============================================================================
--- vic/branches/cc/rtp/transmitter.cpp (original)
+++ vic/branches/cc/rtp/transmitter.cpp Thu Apr 29 16:31:39 2010
@@ -96,7 +96,8 @@
loopback_(0),
is_cc_active_(1),
is_buf_empty_(1),
- cc_type_(WBCC)
+ cc_type_(WBCC),
+ cwnd_mode_(BYM)
{
memset((char*)&mh_, 0, sizeof(mh_));
mh_.msg_iovlen = 2;
@@ -317,20 +318,38 @@
void Transmitter::cc_tfwc_output(pktbuf* pb)
{
//cc_output_banner_top();
- // pb is not null, hence parse it.
- rtphdr* rh = (rtphdr *) pb->data;
-
- int magic = (int) tfwc_magic();
- //debug_msg("cwnd: %d\n", magic);
- int jack = (int) tfwc_sndr_jacked();
- //debug_msg("jack: %d\n", jack);
- if (ntohs(rh->rh_seqno) <= magic + jack) {
- // move head pointer
- head_ = pb->next;
- // call Transmitter::output_data_only w/ XR reception
- output_data_only(pb, XR_RECV);
+ // byte mode? or packet mode?
+ switch (cwnd_mode_) {
+ case BYM:
+ {
+ int len = 0;
+ if(pb->len < tfwc_bmagic() - len) {
+ len = pb->len;
+ // move head pointer
+ head_ = pb->next;
+ // call Transmitter::output_data_only w/ XR reception
+ output_data_only(pb, XR_RECV);
+ }
+ }
+ break;
+ case PKM:
+ {
+ // pb is not null, hence parse it.
+ rtphdr* rh = (rtphdr *) pb->data;
+
+ if (ntohs(rh->rh_seqno) <= tfwc_magic() + tfwc_sndr_jacked()) {
+ //debug_msg("cwnd: %d\n", tfwc_magic());
+ //debug_msg("jack: %d\n", tfwc_sndr_jacked());
+
+ // move head pointer
+ head_ = pb->next;
+ // call Transmitter::output_data_only w/ XR reception
+ output_data_only(pb, XR_RECV);
+ }
}
+ break;
+ } // switch (cwnd_mode_)
//cc_output_banner_bottom();
}
@@ -352,36 +371,52 @@
return;
}
- // pb is not null, hence parse it.
- rtphdr* rh = (rtphdr *) pb->data;
-
- // cwnd value
- int magic = (int) tfwc_magic();
-// debug_msg("cwnd: %d\n", magic);
-
- // just acked seqno
- int jack = (int) tfwc_sndr_jacked();
-// debug_msg("jack: %d\n", jack);
-
- //fprintf(stderr, "\tXXX now: %f\tnum: %d\tcwnd: %d\tjack: %d\n",
- //tx_get_now(), ntohs(rh->rh_seqno), magic, jack);
-
- // while packet seqno is within "cwnd + jack", send that packet
- while (ntohs(rh->rh_seqno) <= magic + jack) {
- // move head pointer
- head_ = pb->next;
- // call Transmitter::output(pb)
- output(pb, recv_by_ch);
-
- // if the moved head pointer is not null, parse packet buffer.
- // otherwise, break while statement.
- if (head_ != 0) {
- pb = head_;
- rh = (rtphdr *) pb->data;
- } else {
- break;
+ // byte mode? or packet mode?
+ switch (cwnd_mode_) {
+ case BYM:
+ {
+ int len = 0;
+ while(pb->len < tfwc_bmagic() - len) {
+ len = pb->len;
+ // move head pointer
+ head_ = pb->next;
+ // call Transmitter::output(pb)
+ output(pb, XR_RECV);
+
+ if (head_ != 0)
+ pb = head_;
+ else
+ break;
}
- } // end while ()
+ }
+ break;
+ case PKM:
+ {
+ // pb is not null, hence parse it.
+ rtphdr* rh = (rtphdr *) pb->data;
+
+ // while packet seqno is within "cwnd + jack", send that packet
+ while (ntohs(rh->rh_seqno) <= tfwc_magic() + tfwc_sndr_jacked()) {
+ //debug_msg("cwnd: %d\n", tfwc_magic());
+ //debug_msg("jack: %d\n", tfwc_sndr_jacked());
+
+ // move head pointer
+ head_ = pb->next;
+ // call Transmitter::output(pb)
+ output(pb, recv_by_ch);
+
+ // if the moved head pointer is not null, parse packet buffer.
+ // otherwise, break while statement.
+ if (head_ != 0) {
+ pb = head_;
+ rh = (rtphdr *) pb->data;
+ } else {
+ break;
+ }
+ } // end while ()
+ }
+ break;
+ } // switch (cwnd_mode_)
//cc_output_banner_bottom();
}
Modified: vic/branches/cc/rtp/transmitter.h
==============================================================================
--- vic/branches/cc/rtp/transmitter.h (original)
+++ vic/branches/cc/rtp/transmitter.h Thu Apr 29 16:31:39 2010
@@ -56,6 +56,10 @@
#define WBCC 101
#define RBCC 102
+// cwnd mode
+#define PKM 1 // PacKet Mode
+#define BYM 2 // BYtes Mode
+
/*
* The base object for performing the outbound path of
* the application level protocol.
@@ -150,6 +154,7 @@
bool is_cc_active_; /* is Cc module activated? */
bool is_buf_empty_; /* is pktbuf empty? */
int cc_type_;
+ int cwnd_mode_; /* byte-mode? or packet-mode */
int epc_; /* experimental packet counter */
private:
More information about the Sumover-dev
mailing list