Skip to content

Commit

Permalink
tcp: back retransmit_high when it over-estimated
Browse files Browse the repository at this point in the history
If lost skb is sacked, we might have nothing to retransmit
as high as the retransmit_high is pointing to, so place
it lower to avoid unnecessary walking.

This is mainly for the case where high L'ed skbs gets sacked.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ilpo Järvinen authored and David S. Miller committed Sep 21, 2008
1 parent 90638a0 commit 618d9f2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions net/ipv4/tcp_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -2035,16 +2035,22 @@ void tcp_xmit_retransmit_queue(struct sock *sk)
struct tcp_sock *tp = tcp_sk(sk);
struct sk_buff *skb;
struct sk_buff *hole = NULL;
u32 last_lost;
int mib_idx;
int fwd_rexmitting = 0;

if (!tp->lost_out)
tp->retransmit_high = tp->snd_una;

if (tp->retransmit_skb_hint)
if (tp->retransmit_skb_hint) {
skb = tp->retransmit_skb_hint;
else
last_lost = TCP_SKB_CB(skb)->end_seq;
if (after(last_lost, tp->retransmit_high))
last_lost = tp->retransmit_high;
} else {
skb = tcp_write_queue_head(sk);
last_lost = tp->snd_una;
}

/* First pass: retransmit lost packets. */
tcp_for_write_queue_from(skb, sk) {
Expand Down Expand Up @@ -2073,6 +2079,7 @@ void tcp_xmit_retransmit_queue(struct sock *sk)
mib_idx = LINUX_MIB_TCPFORWARDRETRANS;

} else if (!before(TCP_SKB_CB(skb)->seq, tp->retransmit_high)) {
tp->retransmit_high = last_lost;
if (!tcp_can_forward_retransmit(sk))
break;
/* Backtrack if necessary to non-L'ed skb */
Expand All @@ -2089,6 +2096,7 @@ void tcp_xmit_retransmit_queue(struct sock *sk)
continue;

} else {
last_lost = TCP_SKB_CB(skb)->end_seq;
if (icsk->icsk_ca_state != TCP_CA_Loss)
mib_idx = LINUX_MIB_TCPFASTRETRANS;
else
Expand Down

0 comments on commit 618d9f2

Please sign in to comment.