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.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 50788d67bdb7..8c8de2780c7a 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1093,6 +1093,13 @@ static void __pskb_trim_head(struct sk_buff *skb, int len)
1093{ 1093{
1094 int i, k, eat; 1094 int i, k, eat;
1095 1095
1096 eat = min_t(int, len, skb_headlen(skb));
1097 if (eat) {
1098 __skb_pull(skb, eat);
1099 len -= eat;
1100 if (!len)
1101 return;
1102 }
1096 eat = len; 1103 eat = len;
1097 k = 0; 1104 k = 0;
1098 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { 1105 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
@@ -1124,11 +1131,7 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len)
1124 if (skb_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) 1131 if (skb_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
1125 return -ENOMEM; 1132 return -ENOMEM;
1126 1133
1127 /* If len == headlen, we avoid __skb_pull to preserve alignment. */ 1134 __pskb_trim_head(skb, len);
1128 if (unlikely(len < skb_headlen(skb)))
1129 __skb_pull(skb, len);
1130 else
1131 __pskb_trim_head(skb, len - skb_headlen(skb));
1132 1135
1133 TCP_SKB_CB(skb)->seq += len; 1136 TCP_SKB_CB(skb)->seq += len;
1134 skb->ip_summed = CHECKSUM_PARTIAL; 1137 skb->ip_summed = CHECKSUM_PARTIAL;
@@ -1919,7 +1922,7 @@ u32 __tcp_select_window(struct sock *sk)
1919 if (free_space < (full_space >> 1)) { 1922 if (free_space < (full_space >> 1)) {
1920 icsk->icsk_ack.quick = 0; 1923 icsk->icsk_ack.quick = 0;
1921 1924
1922 if (tcp_memory_pressure) 1925 if (sk_under_memory_pressure(sk))
1923 tp->rcv_ssthresh = min(tp->rcv_ssthresh, 1926 tp->rcv_ssthresh = min(tp->rcv_ssthresh,
1924 4U * tp->advmss); 1927 4U * tp->advmss);
1925 1928