Commit f55cdc77 authored by David S. Miller's avatar David S. Miller

[TCP]: Fix packet counting when fragmenting already sent packets.

Calls to tcp_fragment() change the tso_factor of
an SKB, so we need to deal with that.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2be2626d
...@@ -681,8 +681,12 @@ int tcp_write_xmit(struct sock *sk, int nonagle) ...@@ -681,8 +681,12 @@ int tcp_write_xmit(struct sock *sk, int nonagle)
TCP_SKB_CB(skb)->when = tcp_time_stamp; TCP_SKB_CB(skb)->when = tcp_time_stamp;
if (tcp_transmit_skb(sk, skb_clone(skb, GFP_ATOMIC))) if (tcp_transmit_skb(sk, skb_clone(skb, GFP_ATOMIC)))
break; 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); update_send_head(sk, tp, skb);
tcp_minshall_update(tp, mss_now, skb); tcp_minshall_update(tp, mss_now, skb);
sent_pkts = 1; sent_pkts = 1;
} }
...@@ -968,11 +972,17 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) ...@@ -968,11 +972,17 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
return -EAGAIN; return -EAGAIN;
if (skb->len > cur_mss) { if (skb->len > cur_mss) {
int old_factor = TCP_SKB_CB(skb)->tso_factor;
int new_factor;
if (tcp_fragment(sk, skb, cur_mss)) if (tcp_fragment(sk, skb, cur_mss))
return -ENOMEM; /* We'll try again later. */ return -ENOMEM; /* We'll try again later. */
/* New SKB created, account for it. */ /* 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. */ /* Collapse two adjacent packets if worthwhile and we can. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment