[RFC][PATCH 1/2] TCP: fix lost retransmit detection

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: TAKANO Ryousei
Date: Thursday, October 4, 2007 - 2:45 am

This patch allows to detect loss of retransmitted packets more
accurately by using the highest end sequence number among SACK 
blocks.  Before the retransmission queue is scanned, the highest
end sequence number (high_end_seq) is retrieved, and this value
is compared with the ack_seq of each packet.

Signed-off-by: Ryousei Takano <takano-ryousei@aist.go.jp>
Signed-off-by: Yuetsu Kodama <y-kodama@aist.go.jp>
---
 net/ipv4/tcp_input.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index bbad2cd..12db4b3 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -978,6 +978,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
 	int cached_fack_count;
 	int i;
 	int first_sack_index;
+	__u32 high_end_seq;
 
 	if (!tp->sacked_out)
 		tp->fackets_out = 0;
@@ -1012,6 +1013,14 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
 	if (before(TCP_SKB_CB(ack_skb)->ack_seq, prior_snd_una - tp->max_window))
 		return 0;
 
+	/* Retrieve the highest end_seq among SACK blocks. */
+	high_end_seq = ntohl(sp[0].end_seq);
+	for (i = 1; i < num_sacks; i++) {
+		__u32 end_seq = ntohl(sp[i].end_seq);
+		if (after(end_seq, high_end_seq))
+			high_end_seq = end_seq;
+	}
+
 	/* SACK fastpath:
 	 * if the only SACK change is the increase of the end_seq of
 	 * the first block then only apply that SACK block
@@ -1161,9 +1170,8 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
 			}
 
 			if ((sacked&TCPCB_SACKED_RETRANS) &&
-			    after(end_seq, TCP_SKB_CB(skb)->ack_seq) &&
-			    (!lost_retrans || after(end_seq, lost_retrans)))
-				lost_retrans = end_seq;
+			    after(high_end_seq, TCP_SKB_CB(skb)->ack_seq))
+				lost_retrans = high_end_seq;
 
 			if (!in_sack)
 				continue;
-- 
1.5.2.4

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC][PATCH 1/2] TCP: fix lost retransmit detection, TAKANO Ryousei, (Thu Oct 4, 2:45 am)
Re: [RFC][PATCH 1/2] TCP: fix lost retransmit detection, Ilpo Järvinen, (Fri Oct 5, 3:02 am)
Re: [RFC][PATCH 1/2] TCP: fix lost retransmit detection, TAKANO Ryousei, (Sat Oct 6, 10:51 pm)
Re: [RFC][PATCH 1/2] TCP: fix lost retransmit detection, David Miller, (Sat Oct 6, 11:17 pm)
Re: [RFC][PATCH 1/2] TCP: fix lost retransmit detection, TAKANO Ryousei, (Sun Oct 7, 1:42 am)
Re: [RFC][PATCH 1/2] TCP: fix lost retransmit detection, Ilpo Järvinen, (Sun Oct 7, 8:11 am)
Re: [RFC][PATCH 1/2] TCP: fix lost retransmit detection, Ilpo Järvinen, (Mon Oct 8, 4:11 am)
Re: [RFC][PATCH 1/2] TCP: fix lost retransmit detection, TAKANO Ryousei, (Mon Oct 8, 11:28 pm)
Re: [RFC][PATCH 1/2] TCP: fix lost retransmit detection, Ilpo Järvinen, (Tue Oct 9, 5:19 am)