tcp: convert retransmit_cnt_hint to seqno

Main benefit in this is that we can then freely point
the retransmit_skb_hint to anywhere we want to because
there's no longer need to know what would be the count
changes involve, and since this is really used only as a
terminator, unnecessary work is one time walk at most,
and if some retransmissions are necessary after that
point later on, the walk is not full waste of time
anyway.

Since retransmit_high must be kept valid, all lost
markers must ensure that.

Now I also have learned how those "holes" in the
rexmittable skbs can appear, mtu probe does them. So
I removed the misleading comment as well.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Ilpo Järvinen 2008-09-20 21:20:20 -07:00 committed by David S. Miller
parent 41ea36e35a
commit 006f582c73
4 changed files with 30 additions and 33 deletions

View file

@ -1838,7 +1838,7 @@ void tcp_simple_retransmit(struct sock *sk)
struct tcp_sock *tp = tcp_sk(sk);
struct sk_buff *skb;
unsigned int mss = tcp_current_mss(sk, 0);
int lost = 0;
u32 prior_lost = tp->lost_out;
tcp_for_write_queue(skb, sk) {
if (skb == tcp_send_head(sk))
@ -1849,17 +1849,13 @@ void tcp_simple_retransmit(struct sock *sk)
TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_RETRANS;
tp->retrans_out -= tcp_skb_pcount(skb);
}
if (!(TCP_SKB_CB(skb)->sacked & TCPCB_LOST)) {
TCP_SKB_CB(skb)->sacked |= TCPCB_LOST;
tp->lost_out += tcp_skb_pcount(skb);
lost = 1;
}
tcp_skb_mark_lost_uncond_verify(tp, skb);
}
}
tcp_clear_all_retrans_hints(tp);
if (!lost)
if (prior_lost == tp->lost_out)
return;
if (tcp_is_reno(tp))
@ -2009,15 +2005,11 @@ void tcp_xmit_retransmit_queue(struct sock *sk)
const struct inet_connection_sock *icsk = inet_csk(sk);
struct tcp_sock *tp = tcp_sk(sk);
struct sk_buff *skb;
int packet_cnt;
if (tp->retransmit_skb_hint) {
if (tp->retransmit_skb_hint)
skb = tp->retransmit_skb_hint;
packet_cnt = tp->retransmit_cnt_hint;
} else {
else
skb = tcp_write_queue_head(sk);
packet_cnt = 0;
}
/* First pass: retransmit lost packets. */
if (tp->lost_out) {
@ -2028,7 +2020,6 @@ void tcp_xmit_retransmit_queue(struct sock *sk)
break;
/* we could do better than to assign each time */
tp->retransmit_skb_hint = skb;
tp->retransmit_cnt_hint = packet_cnt;
/* Assume this retransmit will generate
* only one packet for congestion window
@ -2039,6 +2030,8 @@ void tcp_xmit_retransmit_queue(struct sock *sk)
*/
if (tcp_packets_in_flight(tp) >= tp->snd_cwnd)
return;
if (!before(TCP_SKB_CB(skb)->seq, tp->retransmit_high))
break;
if (sacked & TCPCB_LOST) {
if (!(sacked & (TCPCB_SACKED_ACKED|TCPCB_SACKED_RETRANS))) {
@ -2059,10 +2052,6 @@ void tcp_xmit_retransmit_queue(struct sock *sk)
inet_csk(sk)->icsk_rto,
TCP_RTO_MAX);
}
packet_cnt += tcp_skb_pcount(skb);
if (packet_cnt >= tp->lost_out)
break;
}
}
}