]> git.hungrycats.org Git - linux/commitdiff
[TCP]: Fix packet counting when fragmenting already sent packets.
authorDavid S. Miller <davem@nuts.davemloft.net>
Fri, 10 Sep 2004 08:21:43 +0000 (01:21 -0700)
committerDavid S. Miller <davem@nuts.davemloft.net>
Fri, 10 Sep 2004 08:21:43 +0000 (01:21 -0700)
Calls to tcp_fragment() change the tso_factor of
an SKB, so we need to deal with that.

Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_output.c

index eef6f4fa4d3ddcb0464624f0a31adcd1e3674196..a77c17ba48df72337da10b42973b85b5a496c52a 100644 (file)
@@ -681,8 +681,12 @@ int tcp_write_xmit(struct sock *sk, int nonagle)
                        TCP_SKB_CB(skb)->when = tcp_time_stamp;
                        if (tcp_transmit_skb(sk, skb_clone(skb, GFP_ATOMIC)))
                                break;
-                       /* Advance the send_head.  This one is sent out. */
+
+                       /* Advance the send_head.  This one is sent out.
+                        * This call will increment packets_out.
+                        */
                        update_send_head(sk, tp, skb);
+
                        tcp_minshall_update(tp, mss_now, skb);
                        sent_pkts = 1;
                }
@@ -968,11 +972,17 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
                return -EAGAIN;
 
        if (skb->len > cur_mss) {
+               int old_factor = TCP_SKB_CB(skb)->tso_factor;
+               int new_factor;
+
                if (tcp_fragment(sk, skb, cur_mss))
                        return -ENOMEM; /* We'll try again later. */
 
                /* New SKB created, account for it. */
-               tcp_inc_pcount(&tp->packets_out, skb);
+               new_factor = TCP_SKB_CB(skb)->tso_factor;
+               tcp_dec_pcount_explicit(&tp->packets_out,
+                                       new_factor - old_factor);
+               tcp_inc_pcount(&tp->packets_out, skb->next);
        }
 
        /* Collapse two adjacent packets if worthwhile and we can. */