aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@helsinki.fi>2007-11-15 22:42:54 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:54:04 -0500
commit9f58f3b721f52a4d3f497ea57f830ccd307f1d76 (patch)
treeb68450e082170127efb3c9c382884716211e3221 /net/ipv4/tcp_input.c
parenta47e5a988a575e64c8c9bae65a1dfe3dca7cba32 (diff)
[TCP]: Make lost retrans detection more self-contained
Highest_sack_end_seq is no longer calculated in the loop, thus it can be pushed to the worker function altogether making that function independent of the sacktag. Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r--net/ipv4/tcp_input.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 31294b52ad42..7a2bfd85fff0 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1115,16 +1115,23 @@ static int tcp_is_sackblock_valid(struct tcp_sock *tp, int is_dsack,
1115 * 1115 *
1116 * Search retransmitted skbs from write_queue that were sent when snd_nxt was 1116 * Search retransmitted skbs from write_queue that were sent when snd_nxt was
1117 * less than what is now known to be received by the other end (derived from 1117 * less than what is now known to be received by the other end (derived from
1118 * SACK blocks by the caller). Also calculate the lowest snd_nxt among the 1118 * highest SACK block). Also calculate the lowest snd_nxt among the remaining
1119 * remaining retransmitted skbs to avoid some costly processing per ACKs. 1119 * retransmitted skbs to avoid some costly processing per ACKs.
1120 */ 1120 */
1121static int tcp_mark_lost_retrans(struct sock *sk, u32 received_upto) 1121static int tcp_mark_lost_retrans(struct sock *sk)
1122{ 1122{
1123 const struct inet_connection_sock *icsk = inet_csk(sk);
1123 struct tcp_sock *tp = tcp_sk(sk); 1124 struct tcp_sock *tp = tcp_sk(sk);
1124 struct sk_buff *skb; 1125 struct sk_buff *skb;
1125 int flag = 0; 1126 int flag = 0;
1126 int cnt = 0; 1127 int cnt = 0;
1127 u32 new_low_seq = tp->snd_nxt; 1128 u32 new_low_seq = tp->snd_nxt;
1129 u32 received_upto = TCP_SKB_CB(tp->highest_sack)->end_seq;
1130
1131 if (!tcp_is_fack(tp) || !tp->retrans_out ||
1132 !after(received_upto, tp->lost_retrans_low) ||
1133 icsk->icsk_ca_state != TCP_CA_Recovery)
1134 return flag;
1128 1135
1129 tcp_for_write_queue(skb, sk) { 1136 tcp_for_write_queue(skb, sk) {
1130 u32 ack_seq = TCP_SKB_CB(skb)->ack_seq; 1137 u32 ack_seq = TCP_SKB_CB(skb)->ack_seq;
@@ -1245,7 +1252,6 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1245 int num_sacks = (ptr[1] - TCPOLEN_SACK_BASE)>>3; 1252 int num_sacks = (ptr[1] - TCPOLEN_SACK_BASE)>>3;
1246 int reord = tp->packets_out; 1253 int reord = tp->packets_out;
1247 int prior_fackets; 1254 int prior_fackets;
1248 u32 highest_sack_end_seq;
1249 int flag = 0; 1255 int flag = 0;
1250 int found_dup_sack = 0; 1256 int found_dup_sack = 0;
1251 int cached_fack_count; 1257 int cached_fack_count;
@@ -1513,11 +1519,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1513 flag &= ~FLAG_ONLY_ORIG_SACKED; 1519 flag &= ~FLAG_ONLY_ORIG_SACKED;
1514 } 1520 }
1515 1521
1516 highest_sack_end_seq = TCP_SKB_CB(tp->highest_sack)->end_seq; 1522 flag |= tcp_mark_lost_retrans(sk);
1517 if (tcp_is_fack(tp) && tp->retrans_out &&
1518 after(highest_sack_end_seq, tp->lost_retrans_low) &&
1519 icsk->icsk_ca_state == TCP_CA_Recovery)
1520 flag |= tcp_mark_lost_retrans(sk, highest_sack_end_seq);
1521 1523
1522 tcp_verify_left_out(tp); 1524 tcp_verify_left_out(tp);
1523 1525