diff options
author | Vitaliy Gusev <vgusev@openvz.org> | 2008-04-15 23:26:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-04-15 23:26:34 -0400 |
commit | 56f367bbfd5a7439961499ca6a2f0822d2074d83 (patch) | |
tree | cdd34f6fed1fcbaa80f2fb2bf17df4fe03a316db /net/ipv4/tcp_input.c | |
parent | c4cbb34bbdaaa841ef7c027f7b420db4c318c4fd (diff) |
[TCP]: Add return value indication to tcp_prune_ofo_queue().
Returns non-zero if tp->out_of_order_queue was seen non-empty.
This allows tcp_try_rmem_schedule() to return early.
Signed-off-by: Vitaliy Gusev <vgusev@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r-- | net/ipv4/tcp_input.c | 12 |
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 | ||
3844 | static void tcp_prune_ofo_queue(struct sock *sk); | 3844 | static int tcp_prune_ofo_queue(struct sock *sk); |
3845 | static int tcp_prune_queue(struct sock *sk); | 3845 | static int tcp_prune_queue(struct sock *sk); |
3846 | 3846 | ||
3847 | static inline int tcp_try_rmem_schedule(struct sock *sk, unsigned int size) | 3847 | static 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 | */ |
4215 | static void tcp_prune_ofo_queue(struct sock *sk) | 4218 | static 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 |