diff options
author | Neal Cardwell <ncardwell@google.com> | 2012-02-26 05:06:19 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-02-28 15:06:46 -0500 |
commit | 4c90d3b30334833450ccbb02f452d4972a3c3c3f (patch) | |
tree | 36581d7c5fa05c1223e6116f981a5857a02dfb43 /net/ipv4 | |
parent | ecb971923614775a118bc05ad16b2bde450cac7d (diff) |
tcp: fix false reordering signal in tcp_shifted_skb
When tcp_shifted_skb() shifts bytes from the skb that is currently
pointed to by 'highest_sack' then the increment of
TCP_SKB_CB(skb)->seq implicitly advances tcp_highest_sack_seq(). This
implicit advancement, combined with the recent fix to pass the correct
SACKed range into tcp_sacktag_one(), caused tcp_sacktag_one() to think
that the newly SACKed range was before the tcp_highest_sack_seq(),
leading to a call to tcp_update_reordering() with a degree of
reordering matching the size of the newly SACKed range (typically just
1 packet, which is a NOP, but potentially larger).
This commit fixes this by simply calling tcp_sacktag_one() before the
TCP_SKB_CB(skb)->seq advancement that can advance our notion of the
highest SACKed sequence.
Correspondingly, we can simplify the code a little now that
tcp_shifted_skb() should update the lost_cnt_hint in all cases where
skb == tp->lost_skb_hint.
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/tcp_input.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 53c8ce4046b2..ee42d42b2f45 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -1403,8 +1403,16 @@ static int tcp_shifted_skb(struct sock *sk, struct sk_buff *skb, | |||
1403 | 1403 | ||
1404 | BUG_ON(!pcount); | 1404 | BUG_ON(!pcount); |
1405 | 1405 | ||
1406 | /* Adjust hint for FACK. Non-FACK is handled in tcp_sacktag_one(). */ | 1406 | /* Adjust counters and hints for the newly sacked sequence |
1407 | if (tcp_is_fack(tp) && (skb == tp->lost_skb_hint)) | 1407 | * range but discard the return value since prev is already |
1408 | * marked. We must tag the range first because the seq | ||
1409 | * advancement below implicitly advances | ||
1410 | * tcp_highest_sack_seq() when skb is highest_sack. | ||
1411 | */ | ||
1412 | tcp_sacktag_one(sk, state, TCP_SKB_CB(skb)->sacked, | ||
1413 | start_seq, end_seq, dup_sack, pcount); | ||
1414 | |||
1415 | if (skb == tp->lost_skb_hint) | ||
1408 | tp->lost_cnt_hint += pcount; | 1416 | tp->lost_cnt_hint += pcount; |
1409 | 1417 | ||
1410 | TCP_SKB_CB(prev)->end_seq += shifted; | 1418 | TCP_SKB_CB(prev)->end_seq += shifted; |
@@ -1430,12 +1438,6 @@ static int tcp_shifted_skb(struct sock *sk, struct sk_buff *skb, | |||
1430 | skb_shinfo(skb)->gso_type = 0; | 1438 | skb_shinfo(skb)->gso_type = 0; |
1431 | } | 1439 | } |
1432 | 1440 | ||
1433 | /* Adjust counters and hints for the newly sacked sequence range but | ||
1434 | * discard the return value since prev is already marked. | ||
1435 | */ | ||
1436 | tcp_sacktag_one(sk, state, TCP_SKB_CB(skb)->sacked, | ||
1437 | start_seq, end_seq, dup_sack, pcount); | ||
1438 | |||
1439 | /* Difference in this won't matter, both ACKed by the same cumul. ACK */ | 1441 | /* Difference in this won't matter, both ACKed by the same cumul. ACK */ |
1440 | TCP_SKB_CB(prev)->sacked |= (TCP_SKB_CB(skb)->sacked & TCPCB_EVER_RETRANS); | 1442 | TCP_SKB_CB(prev)->sacked |= (TCP_SKB_CB(skb)->sacked & TCPCB_EVER_RETRANS); |
1441 | 1443 | ||