[Sumover-dev] [svn commit] r4714 - vic/branches/cc/cc

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Tue Mar 23 02:11:31 GMT 2010


Author: soohyunc
Date: Tue Mar 23 02:11:31 2010
New Revision: 4714

Modified:
   vic/branches/cc/cc/tfwc_rcvr.cpp
   vic/branches/cc/cc/tfwc_rcvr.h
   vic/branches/cc/cc/tfwc_sndr.cpp
   vic/branches/cc/cc/tfwc_sndr.h

Log:
corrected some buggy behaviour for either packet re-ordering or ack re-ordering,
and both.

there could be three cases:
1) packets are delivered in out-of-ordered fashion
2) packets are delivered in-order, but acks are arrived in out-of-ordered
3) both packets and acks are delivered out-of-ordered fashion

this commit can deal with all cases correctly mentioned above.




Modified: vic/branches/cc/cc/tfwc_rcvr.cpp
==============================================================================
--- vic/branches/cc/cc/tfwc_rcvr.cpp	(original)
+++ vic/branches/cc/cc/tfwc_rcvr.cpp	Tue Mar 23 02:11:31 2010
@@ -52,12 +52,16 @@
 	// tfwcAV (bit vector)
 	tfwcAV = (u_int16_t *) malloc(sizeof(u_int16_t *));
 	clear_avec(numVec_);
+	// previous ackofack
+	__ackofack_ = 0;
 }
 
 // retrive ackofack from RTCP control channel
 void TfwcRcvr::tfwc_rcvr_recv_aoa(u_int16_t type, u_int16_t *chunk)
 {
 	int num_chunks = 1;
+	__ackofack_ = ackofack_;
+
 	switch (type) {
 	case XR_BT_1:
 	  {
@@ -81,6 +85,11 @@
 // retrieve data packet sequence number from RTP data channel
 void TfwcRcvr::tfwc_rcvr_recv_seqno(u_int16_t seqno)
 {
+	// out-of-order packet reception
+	// (use previous ackofack)
+	if (seqno < ends_ - 1)
+		ackofack_ = __ackofack_;
+
 	// required number of AckVec elements
 	numElm_ = seqno - ackofack_;
 

Modified: vic/branches/cc/cc/tfwc_rcvr.h
==============================================================================
--- vic/branches/cc/cc/tfwc_rcvr.h	(original)
+++ vic/branches/cc/cc/tfwc_rcvr.h	Tue Mar 23 02:11:31 2010
@@ -103,6 +103,9 @@
 	// reference vector and its iterator
 	std::vector<int> rvec_;
 	std::vector<int>::iterator rvit_;
+
+	// out-of-order packet reception
+	u_int16_t __ackofack_;	// previous ackofack
 };
 
 #endif

Modified: vic/branches/cc/cc/tfwc_sndr.cpp
==============================================================================
--- vic/branches/cc/cc/tfwc_sndr.cpp	(original)
+++ vic/branches/cc/cc/tfwc_sndr.cpp	Tue Mar 23 02:11:31 2010
@@ -162,9 +162,9 @@
 void TfwcSndr::tfwc_sndr_recv(u_int16_t type, u_int16_t begin, u_int16_t end,
 		u_int16_t *chunk, double so_rtime)
 {
-switch (type) {
-// retrieve ackvec
-case XR_BT_1: 
+  switch (type) {
+  // retrieve ackvec
+  case XR_BT_1: 
   {
 	// number of ack received
 	nakp_++;
@@ -200,9 +200,10 @@
 	clear_ackv(num_vec_);
 	// clone AckVec from Vic
 	clone_ackv(chunk, num_vec_);
+	//print_vec(ackv_, num_vec_);
 
 	// detect packet reordering and reordered ack delivery
-	int shift = 0;
+	int shift = abs(__jacked_ - jacked_);
 	if (jacked_ < __jacked_) {
 		// this ack is deprecated message (e.g., too old).
 		if(jacked_ < aoa_) {
@@ -210,7 +211,7 @@
 		  return;
 		}
 		// this ack is delivered out-of-order
-		else if(begins_ <= aoa_) {
+		else if(out_of_ack(jacked_, seqvec_, num_seqvec_)) {
 		  debug_msg("warning: this ack itself is out-of-order!\n");
 		  outofack = true;
 		  // cwnd process
@@ -223,7 +224,6 @@
 		// packet is out-of-order
 		else {
 		  debug_msg("warning: packet reordering occurred!\n");
-		  shift = __jacked_ - jacked_;
 		  // restore the previous state variables
 		  replace(__begins_, __jacked_);
 		  num_elm_ = get_numelm(begins_, jacked_);
@@ -242,6 +242,14 @@
 		ackv_[i] = (ackv_[i] << shift) | pvec_[i];
 		}
 	}
+	// this will ensure constructing ackv correctly,
+	// when there is packet re-ordering.
+	// (e.g., if packet reordering, then ack will be ordered that way.)
+	else {
+		for (int i = 0; i < num_vec_; i++) {
+		ackv_[i] = (pvec_[i] << shift) | ackv_[i];
+		}
+	}
 
 	// generate seqno vector
 	//print_vec(ackv_, num_vec_);
@@ -275,6 +283,7 @@
 	fprintf(stderr, "\tnow: %f\tcwnd: %d\n", so_recv_, cwnd_);
 
 	// set ackofack (real number)
+	if(!reorder)
 	aoa_ = ackofack(); 
 
 	// sampled RTT
@@ -292,8 +301,8 @@
   }
   break;
 
-// retrieve ts echo
-case XR_BT_3:
+  // retrieve ts echo
+  case XR_BT_3:
   {
 	ntep_++;		// number of ts echo packet received
 	ts_echo_ = chunk[num_vec_ - 1];
@@ -304,10 +313,25 @@
   }
   break;
 
-default:
+  default:
   break;
-} // end switch (type)
-return;
+  } // end switch (type)
+
+  return;
+}
+
+/*
+ * detect out-of-ordered ack delivery
+ * -- if just ack'ed seqno (jack) is already in sequence vector,
+ *    then, this ack should've been arrived earlier.
+ *    (i.e., this ack is out-of-ordered)
+ */
+bool TfwcSndr::out_of_ack(u_int16_t target, u_int32_t *sqv, int n) {
+	for (int i = 0; i < n; i++) {
+		if (sqv[i] == target)
+		return true;
+	}
+	return false;
 }
 
 void TfwcSndr::reset_var() {

Modified: vic/branches/cc/cc/tfwc_sndr.h
==============================================================================
--- vic/branches/cc/cc/tfwc_sndr.h	(original)
+++ vic/branches/cc/cc/tfwc_sndr.h	Tue Mar 23 02:11:31 2010
@@ -235,6 +235,9 @@
 	// new RTO
 	void new_rto(double rtt);
 
+	// determine out-of-ordered ack delivery
+	bool out_of_ack (u_int16_t, u_int32_t*, int);
+
 	// AckVec clone from Vic 
 	inline void clone_ackv(u_int16_t *c, int n) {
 		for (int i = 0; i < n; i++)



More information about the Sumover-dev mailing list