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

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Fri Jul 24 16:38:19 BST 2009


Author: soohyunc
Date: Fri Jul 24 16:38:18 2009
New Revision: 4493

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

Log:
TFWC sender can now handle AckVec when it has more than 16 entires (i.e., it can
handle AckVec that contains more than 16 packet information).



Modified: vic/branches/cc/cc/tfwc_sndr.cpp
==============================================================================
--- vic/branches/cc/cc/tfwc_sndr.cpp	(original)
+++ vic/branches/cc/cc/tfwc_sndr.cpp	Fri Jul 24 16:38:18 2009
@@ -145,7 +145,7 @@
 		// XXX generate seqno vec
 		printf("    [%s +%d] begins:%d, ends:%d, jacked:%d\n", 
 				__FILE__, __LINE__, begins_, ends_, jacked_);
-		gen_seqvec(begins_, ends_, jacked_, ackv_[0]);
+		gen_seqvec(num_chunks, ackv_);
 		free(ackv_);
 		print_seqvec(begins_, ends_);
 
@@ -196,6 +196,37 @@
 }
 
 /*
+ * generate seqno vector 
+ * (interpret the received AckVec to real sequence numbers)
+ * @num_chunks: number of AckVec chunks
+ * @ackvec: received AckVec
+ */
+void TfwcSndr::gen_seqvec (u_int16_t num_chunks, u_int16_t *ackvec) {
+	// number of seqvec elements 
+	// (i.e., number of packets in AckVec)
+	int numElm = ends_ - begins_;
+
+	// start of seqvec
+	int start = jacked_;
+
+	int i, j, k = 0;
+	for (i = 0; i < num_chunks-1; i++) {
+		for (j = 0; j < 16; j++) {
+			if ( CHECK_BIT_AT(ackvec[i], (j+1)) )
+				seqvec_[k++%SSZ] = start;
+			start--;
+		}
+	}
+
+	int a = (numElm%16 == 0) ? 16 : numElm%16;
+	for (i = 0; i < a; i++) {
+		if ( CHECK_BIT_AT(ackvec[num_chunks-1], i+1 ))
+			seqvec_[k++%SSZ] = start;
+		start--;
+	}
+}
+
+/*
  * detect packet loss in the received vector
  * @ret: true when there is a loss
  */

Modified: vic/branches/cc/cc/tfwc_sndr.h
==============================================================================
--- vic/branches/cc/cc/tfwc_sndr.h	(original)
+++ vic/branches/cc/cc/tfwc_sndr.h	Fri Jul 24 16:38:18 2009
@@ -98,6 +98,9 @@
 	u_int32_t cwnd_;	// congestion window
 
 protected:
+	// generate sequence numbers
+	void gen_seqvec(u_int16_t num_chunks, u_int16_t *ackvec);
+
 	// get the first position in ackvec where 1 is marked
 	inline u_int16_t get_head_pos(u_int16_t ackvec) {
 		int l;
@@ -122,20 +125,6 @@
 			// round up if it is less than zero
 			mvec_[i] = ((hseq - i) < 0) ? 0 : (hseq - i);
 	}
-	// generate seqno vector (interpret ackvec to real sequence numbers)
-	inline void gen_seqvec(u_int16_t begins, u_int16_t ends, 
-			u_int16_t hseq, u_int16_t ackvec) {
-		int cnt = ends - begins;	// number of packets in ackvec
-		int offset = 0;				// if the bit is zero, then increment 
-	
-		// ??? Doesn't take account of ackvec from more than one chunk
-		for (int i = 0; i < cnt; i++) {
-			if( CHECK_BIT_AT(ackvec, (cnt-i)) )
-				seqvec_[(i-offset)%SSZ] = hseq - i;
-			else
-				offset++;
-		}
-	}
 	// ackofack
 	inline u_int16_t ackofack () {
 		return ((mvec_[DUPACKS - 1] - 1) <= 0) ?



More information about the Sumover-dev mailing list