diff options
author | Eric Dumazet <edumazet@google.com> | 2021-02-13 00:22:14 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-02-13 02:28:26 +0100 |
commit | 05dc72aba364d374a27de567fac58c199ff5ee97 (patch) | |
tree | 22d94eb4e97e02482f4528a7590f112f819a10ac /net/ipv4/tcp_input.c | |
parent | tcp: fix SO_RCVLOWAT related hangs under mem pressure (diff) | |
download | linux-05dc72aba364d374a27de567fac58c199ff5ee97.tar.xz linux-05dc72aba364d374a27de567fac58c199ff5ee97.zip |
tcp: factorize logic into tcp_epollin_ready()
Both tcp_data_ready() and tcp_stream_is_readable() share the same logic.
Add tcp_epollin_ready() helper to avoid duplication.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Arjun Roy <arjunroy@google.com>
Cc: Wei Wang <weiwan@google.com>
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 | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index a8f8f9815953..e32a7056cb76 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -4924,15 +4924,8 @@ err: void tcp_data_ready(struct sock *sk) { - const struct tcp_sock *tp = tcp_sk(sk); - int avail = tp->rcv_nxt - tp->copied_seq; - - if (avail < sk->sk_rcvlowat && !tcp_rmem_pressure(sk) && - !sock_flag(sk, SOCK_DONE) && - tcp_receive_window(tp) > inet_csk(sk)->icsk_ack.rcv_mss) - return; - - sk->sk_data_ready(sk); + if (tcp_epollin_ready(sk, sk->sk_rcvlowat)) + sk->sk_data_ready(sk); } static void tcp_data_queue(struct sock *sk, struct sk_buff *skb) |