[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] Doh, patch attached (dup ACK behavior with SACK)



Seems like I do this all too often...

The patch described in my email "dup ACK behavior with SACK" is actually
attached to this email.  :-P
Ethan

-- 
I know, I know...  You've been sent by the gods to be my wife.  So listen
up:  I like my eggs over easy, don't bother me when I'm watchin' wrestlin',
and most of all - give me my space, baby.
		-- Johnny Bravo
diff -u unpatched/scoreboard.cc patched/scoreboard.cc
--- unpatched/scoreboard.cc	Fri Jul 21 11:41:41 2000
+++ patched/scoreboard.cc	Fri Jul 21 11:41:51 2000
@@ -62,6 +62,8 @@
 {
 	int i, sack_index, sack_left, sack_right;
 	int retran_decr = 0;
+	
+	changed_ = 0;
 
 	//  If there is no scoreboard, create one.
 	if (length_ == 0 && tcph->sa_length()) {
@@ -78,6 +80,7 @@
 			printf ("Error, scoreboard too large (increase SBSIZE for more space)\n");
 			exit(1);
 		}
+		changed_++;
 	}	
 	
 	//  Advance the left edge of the block.
@@ -97,6 +100,7 @@
 					SBNI.snd_nxt_ = 0;
 					retran_decr++;
 				}
+				changed_++;
 				if (length_==0) 
 					break;
 			}
@@ -122,6 +126,7 @@
 					printf ("Error, scoreboard too large (increase SBSIZE for more space)\n");
 					exit(1);
 				}
+				changed_++;
 			}
 		}
 		
@@ -130,6 +135,7 @@
 			if (SBNI.seq_no_ >= sack_left && SBNI.seq_no_ < sack_right) {
 				if (! SBNI.sack_flag_) {
 					SBNI.sack_flag_ = 1;
+					changed_++;
 				}
 				if (SBNI.retran_) {
 					SBNI.retran_ = 0;
diff -u unpatched/scoreboard.h patched/scoreboard.h
--- unpatched/scoreboard.h	Fri Jul 21 11:41:41 2000
+++ patched/scoreboard.h	Fri Jul 21 11:41:51 2000
@@ -53,11 +53,12 @@
 	void MarkRetran (int retran_seqno, int snd_nxt);
 	int MarkDSacked(int seqno);
 	int UpdateScoreBoard (int last_ack_, hdr_tcp*);
+	int CheckUpdate() {return (changed_);}
 	int CheckSndNxt (hdr_tcp*);
 	int CheckRetran (int seqno);
 	
   protected:
-	int first_, length_;
+	int first_, length_, changed_;
 	struct ScoreBoardNode {
 		int seq_no_;		/* Packet number */
 		int ack_flag_;		/* Acked by cumulative ACK */
diff -u unpatched/tcp-sack1.cc patched/tcp-sack1.cc
--- unpatched/tcp-sack1.cc	Fri Jul 21 11:42:34 2000
+++ patched/tcp-sack1.cc	Fri Jul 21 11:42:39 2000
@@ -19,7 +19,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /home/elb/.CVS_rep/ns-2/tcp-sack1.cc,v 1.11 2000/07/19 16:34:30 elb Exp $ (PSC)";
+    "@(#) $Header: /home/elb/.CVS_rep/ns-2/tcp-sack1.cc,v 1.12 2000/07/21 15:07:31 elb Exp $ (PSC)";
 #endif
 
 #include <stdio.h>
@@ -159,20 +159,22 @@
 			/*
 		 	 * Check for a duplicate ACK
 			 */
-			if (++dupacks_ == NUMDUPACKS) {
-				/*
-				 * Assume we dropped just one packet.
-				 * Retransmit last ack + 1
-				 * and try to resume the sequence.
-				 */
-				dupack_action();
-			} else if (dupacks_ < NUMDUPACKS && singledup_ ) {
-				 /* 
-				  * A more cautious implementation would
-				  * verify that the dupack reports the
-				  * reception of new data...
-				  */
-                       		 send_one();
+		        if(scb_.CheckUpdate()) {
+			 	if (++dupacks_ == NUMDUPACKS) {
+					/*
+					 * Assume we dropped just one packet.
+					 * Retransmit last ack + 1
+					 * and try to resume the sequence.
+					 */
+				   dupack_action();
+				} else if (dupacks_ < NUMDUPACKS && singledup_ ) {
+					/* 
+					 * A more cautious implementation would
+					 * verify that the dupack reports the
+					 * reception of new data...
+					 */
+				         send_one();
+				}
                 	}
 		}
 		if (dupacks_ == 0)
@@ -218,8 +220,10 @@
 		} else if (timeout_ == FALSE) {
 			/* got another dup ack */
 			scb_.UpdateScoreBoard (highest_ack_, tcph);
-			if (dupacks_ > 0)
-				dupacks_++;
+		        if(scb_.CheckUpdate()) {
+				if (dupacks_ > 0)
+			        	dupacks_++;
+			}
 		}
 		send_much(FALSE, 0, maxburst_);
 	}