aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_output.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r--net/ipv4/tcp_output.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 9058e0a25107..7a4834a2ae84 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -637,7 +637,8 @@ static void tcp_queue_skb(struct sock *sk, struct sk_buff *skb)
637 tp->write_seq = TCP_SKB_CB(skb)->end_seq; 637 tp->write_seq = TCP_SKB_CB(skb)->end_seq;
638 skb_header_release(skb); 638 skb_header_release(skb);
639 tcp_add_write_queue_tail(sk, skb); 639 tcp_add_write_queue_tail(sk, skb);
640 sk_charge_skb(sk, skb); 640 sk->sk_wmem_queued += skb->truesize;
641 sk_mem_charge(sk, skb->truesize);
641} 642}
642 643
643static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb, unsigned int mss_now) 644static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb, unsigned int mss_now)
@@ -701,7 +702,8 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss
701 if (buff == NULL) 702 if (buff == NULL)
702 return -ENOMEM; /* We'll just try again later. */ 703 return -ENOMEM; /* We'll just try again later. */
703 704
704 sk_charge_skb(sk, buff); 705 sk->sk_wmem_queued += buff->truesize;
706 sk_mem_charge(sk, buff->truesize);
705 nlen = skb->len - len - nsize; 707 nlen = skb->len - len - nsize;
706 buff->truesize += nlen; 708 buff->truesize += nlen;
707 skb->truesize -= nlen; 709 skb->truesize -= nlen;
@@ -825,7 +827,7 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len)
825 827
826 skb->truesize -= len; 828 skb->truesize -= len;
827 sk->sk_wmem_queued -= len; 829 sk->sk_wmem_queued -= len;
828 sk->sk_forward_alloc += len; 830 sk_mem_uncharge(sk, len);
829 sock_set_flag(sk, SOCK_QUEUE_SHRUNK); 831 sock_set_flag(sk, SOCK_QUEUE_SHRUNK);
830 832
831 /* Any change of skb->len requires recalculation of tso 833 /* Any change of skb->len requires recalculation of tso
@@ -1197,7 +1199,8 @@ static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len,
1197 if (unlikely(buff == NULL)) 1199 if (unlikely(buff == NULL))
1198 return -ENOMEM; 1200 return -ENOMEM;
1199 1201
1200 sk_charge_skb(sk, buff); 1202 sk->sk_wmem_queued += buff->truesize;
1203 sk_mem_charge(sk, buff->truesize);
1201 buff->truesize += nlen; 1204 buff->truesize += nlen;
1202 skb->truesize -= nlen; 1205 skb->truesize -= nlen;
1203 1206
@@ -1350,7 +1353,8 @@ static int tcp_mtu_probe(struct sock *sk)
1350 /* We're allowed to probe. Build it now. */ 1353 /* We're allowed to probe. Build it now. */
1351 if ((nskb = sk_stream_alloc_skb(sk, probe_size, GFP_ATOMIC)) == NULL) 1354 if ((nskb = sk_stream_alloc_skb(sk, probe_size, GFP_ATOMIC)) == NULL)
1352 return -1; 1355 return -1;
1353 sk_charge_skb(sk, nskb); 1356 sk->sk_wmem_queued += nskb->truesize;
1357 sk_mem_charge(sk, nskb->truesize);
1354 1358
1355 skb = tcp_send_head(sk); 1359 skb = tcp_send_head(sk);
1356 1360
@@ -1377,7 +1381,7 @@ static int tcp_mtu_probe(struct sock *sk)
1377 * Throw it away. */ 1381 * Throw it away. */
1378 TCP_SKB_CB(nskb)->flags |= TCP_SKB_CB(skb)->flags; 1382 TCP_SKB_CB(nskb)->flags |= TCP_SKB_CB(skb)->flags;
1379 tcp_unlink_write_queue(skb, sk); 1383 tcp_unlink_write_queue(skb, sk);
1380 sk_stream_free_skb(sk, skb); 1384 sk_wmem_free_skb(sk, skb);
1381 } else { 1385 } else {
1382 TCP_SKB_CB(nskb)->flags |= TCP_SKB_CB(skb)->flags & 1386 TCP_SKB_CB(nskb)->flags |= TCP_SKB_CB(skb)->flags &
1383 ~(TCPCB_FLAG_FIN|TCPCB_FLAG_PSH); 1387 ~(TCPCB_FLAG_FIN|TCPCB_FLAG_PSH);
@@ -1744,7 +1748,7 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *skb, int m
1744 /* changed transmit queue under us so clear hints */ 1748 /* changed transmit queue under us so clear hints */
1745 tcp_clear_retrans_hints_partial(tp); 1749 tcp_clear_retrans_hints_partial(tp);
1746 1750
1747 sk_stream_free_skb(sk, next_skb); 1751 sk_wmem_free_skb(sk, next_skb);
1748 } 1752 }
1749} 1753}
1750 1754
@@ -2139,8 +2143,9 @@ int tcp_send_synack(struct sock *sk)
2139 tcp_unlink_write_queue(skb, sk); 2143 tcp_unlink_write_queue(skb, sk);
2140 skb_header_release(nskb); 2144 skb_header_release(nskb);
2141 __tcp_add_write_queue_head(sk, nskb); 2145 __tcp_add_write_queue_head(sk, nskb);
2142 sk_stream_free_skb(sk, skb); 2146 sk_wmem_free_skb(sk, skb);
2143 sk_charge_skb(sk, nskb); 2147 sk->sk_wmem_queued += nskb->truesize;
2148 sk_mem_charge(sk, nskb->truesize);
2144 skb = nskb; 2149 skb = nskb;
2145 } 2150 }
2146 2151
@@ -2343,7 +2348,8 @@ int tcp_connect(struct sock *sk)
2343 tp->retrans_stamp = TCP_SKB_CB(buff)->when; 2348 tp->retrans_stamp = TCP_SKB_CB(buff)->when;
2344 skb_header_release(buff); 2349 skb_header_release(buff);
2345 __tcp_add_write_queue_tail(sk, buff); 2350 __tcp_add_write_queue_tail(sk, buff);
2346 sk_charge_skb(sk, buff); 2351 sk->sk_wmem_queued += buff->truesize;
2352 sk_mem_charge(sk, buff->truesize);
2347 tp->packets_out += tcp_skb_pcount(buff); 2353 tp->packets_out += tcp_skb_pcount(buff);
2348 tcp_transmit_skb(sk, buff, 1, GFP_KERNEL); 2354 tcp_transmit_skb(sk, buff, 1, GFP_KERNEL);
2349 2355