aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r--net/ipv4/tcp_input.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 61db7b1eb995..bbb7d88a16b4 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3841,7 +3841,7 @@ static void tcp_ofo_queue(struct sock *sk)
3841 } 3841 }
3842} 3842}
3843 3843
3844static void tcp_prune_ofo_queue(struct sock *sk); 3844static int tcp_prune_ofo_queue(struct sock *sk);
3845static int tcp_prune_queue(struct sock *sk); 3845static int tcp_prune_queue(struct sock *sk);
3846 3846
3847static inline int tcp_try_rmem_schedule(struct sock *sk, unsigned int size) 3847static inline int tcp_try_rmem_schedule(struct sock *sk, unsigned int size)
@@ -3853,7 +3853,9 @@ static inline int tcp_try_rmem_schedule(struct sock *sk, unsigned int size)
3853 return -1; 3853 return -1;
3854 3854
3855 if (!sk_rmem_schedule(sk, size)) { 3855 if (!sk_rmem_schedule(sk, size)) {
3856 tcp_prune_ofo_queue(sk); 3856 if (!tcp_prune_ofo_queue(sk))
3857 return -1;
3858
3857 if (!sk_rmem_schedule(sk, size)) 3859 if (!sk_rmem_schedule(sk, size))
3858 return -1; 3860 return -1;
3859 } 3861 }
@@ -4211,10 +4213,12 @@ static void tcp_collapse_ofo_queue(struct sock *sk)
4211 4213
4212/* 4214/*
4213 * Purge the out-of-order queue. 4215 * Purge the out-of-order queue.
4216 * Return true if queue was pruned.
4214 */ 4217 */
4215static void tcp_prune_ofo_queue(struct sock *sk) 4218static int tcp_prune_ofo_queue(struct sock *sk)
4216{ 4219{
4217 struct tcp_sock *tp = tcp_sk(sk); 4220 struct tcp_sock *tp = tcp_sk(sk);
4221 int res = 0;
4218 4222
4219 if (!skb_queue_empty(&tp->out_of_order_queue)) { 4223 if (!skb_queue_empty(&tp->out_of_order_queue)) {
4220 NET_INC_STATS_BH(LINUX_MIB_OFOPRUNED); 4224 NET_INC_STATS_BH(LINUX_MIB_OFOPRUNED);
@@ -4228,7 +4232,9 @@ static void tcp_prune_ofo_queue(struct sock *sk)
4228 if (tp->rx_opt.sack_ok) 4232 if (tp->rx_opt.sack_ok)
4229 tcp_sack_reset(&tp->rx_opt); 4233 tcp_sack_reset(&tp->rx_opt);
4230 sk_mem_reclaim(sk); 4234 sk_mem_reclaim(sk);
4235 res = 1;
4231 } 4236 }
4237 return res;
4232} 4238}
4233 4239
4234/* Reduce allocated memory if we can, trying to get 4240/* Reduce allocated memory if we can, trying to get