diff options
author | Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> | 2007-10-09 01:24:15 -0700 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 16:52:08 -0700 |
commit | 91fed7a15c9222af29a653ecb0ee72cff178fdd8 (patch) | |
tree | 53c72bd6c1bf3216e46565761bc34ea066f5b995 /net/ipv4/tcp_input.c | |
parent | 0dde7b5404a3d52dcd9ce66d46197f6c3ca97dda (diff) | |
download | lwn-91fed7a15c9222af29a653ecb0ee72cff178fdd8.tar.gz lwn-91fed7a15c9222af29a653ecb0ee72cff178fdd8.zip |
[TCP]: Make fackets_out accurate
Substraction for fackets_out is unconditional when snd_una
advances, thus there's no need to do it inside the loop. Just
make sure correct bounds are honored.
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.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index f9e4d7ad68b7..46aedd6ca020 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -2299,8 +2299,8 @@ tcp_fastretrans_alert(struct sock *sk, int pkts_acked, int flag) * 1. Reno does not count dupacks (sacked_out) automatically. */ if (!tp->packets_out) tp->sacked_out = 0; - /* 2. SACK counts snd_fack in packets inaccurately. */ - if (tp->sacked_out == 0) + + if (WARN_ON(!tp->sacked_out && tp->fackets_out)) tp->fackets_out = 0; /* Now state machine starts. @@ -2568,10 +2568,6 @@ static int tcp_tso_acked(struct sock *sk, struct sk_buff *skb, } else if (*seq_rtt < 0) *seq_rtt = now - scb->when; - if (tp->fackets_out) { - __u32 dval = min(tp->fackets_out, packets_acked); - tp->fackets_out -= dval; - } /* hint's skb might be NULL but we don't need to care */ tp->fastpath_cnt_hint -= min_t(u32, packets_acked, tp->fastpath_cnt_hint); @@ -2657,7 +2653,6 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) seq_rtt = now - scb->when; last_ackt = skb->tstamp; } - tcp_dec_pcount_approx(&tp->fackets_out, skb); tp->packets_out -= tcp_skb_pcount(skb); tcp_unlink_write_queue(skb, sk); sk_stream_free_skb(sk, skb); @@ -2672,6 +2667,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) tcp_ack_update_rtt(sk, acked, seq_rtt); tcp_rearm_rto(sk); + tp->fackets_out -= min(pkts_acked, tp->fackets_out); if (tcp_is_reno(tp)) tcp_remove_reno_sacks(sk, pkts_acked); |