aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2005-08-10 21:32:36 -0400
committerDavid S. Miller <davem@davemloft.net>2005-08-10 21:32:36 -0400
commitb5da623ae9be680ea59f268eeb339f0acb2d88c4 (patch)
treeb41844950a11240000d74fb65ce9c4ea82ef2a17 /net
parentbc68552faad0e134eb22281343d5ae5a4873fa80 (diff)
[TCP]: Adjust {p,f}ackets_out correctly in tcp_retransmit_skb()
Well I've only found one potential cause for the assertion failure in tcp_mark_head_lost. First of all, this can only occur if cnt > 1 since tp->packets_out is never zero here. If it did hit zero we'd have much bigger problems. So cnt is equal to fackets_out - reordering. Normally fackets_out is less than packets_out. The only reason I've found that might cause fackets_out to exceed packets_out is if tcp_fragment is called from tcp_retransmit_skb with a TSO skb and the current MSS is greater than the MSS stored in the TSO skb. This might occur as the result of an expiring dst entry. In that case, packets_out may decrease (line 1380-1381 in tcp_output.c). However, fackets_out is unchanged which means that it may in fact exceed packets_out. Previously tcp_retrans_try_collapse was the only place where packets_out can go down and it takes care of this by decrementing fackets_out. So we should make sure that fackets_out is reduced by an appropriate amount here as well. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/tcp_output.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 7d076f0db100..3ed6fc15815b 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1370,15 +1370,21 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
1370 1370
1371 if (skb->len > cur_mss) { 1371 if (skb->len > cur_mss) {
1372 int old_factor = tcp_skb_pcount(skb); 1372 int old_factor = tcp_skb_pcount(skb);
1373 int new_factor; 1373 int diff;
1374 1374
1375 if (tcp_fragment(sk, skb, cur_mss, cur_mss)) 1375 if (tcp_fragment(sk, skb, cur_mss, cur_mss))
1376 return -ENOMEM; /* We'll try again later. */ 1376 return -ENOMEM; /* We'll try again later. */
1377 1377
1378 /* New SKB created, account for it. */ 1378 /* New SKB created, account for it. */
1379 new_factor = tcp_skb_pcount(skb); 1379 diff = old_factor - tcp_skb_pcount(skb) -
1380 tp->packets_out -= old_factor - new_factor; 1380 tcp_skb_pcount(skb->next);
1381 tp->packets_out += tcp_skb_pcount(skb->next); 1381 tp->packets_out -= diff;
1382
1383 if (diff > 0) {
1384 tp->fackets_out -= diff;
1385 if ((int)tp->fackets_out < 0)
1386 tp->fackets_out = 0;
1387 }
1382 } 1388 }
1383 1389
1384 /* Collapse two adjacent packets if worthwhile and we can. */ 1390 /* Collapse two adjacent packets if worthwhile and we can. */