diff options
author | Arseniy Krasnov <AVKrasnov@sberdevices.ru> | 2022-08-19 05:36:52 +0000 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2022-08-23 10:43:11 +0200 |
commit | f2fdcf67aceb1a7d5e0661cb7ca95cda68d3014a (patch) | |
tree | ea286c6e303a705fa6c241383a23332187771f5d /net/vmw_vsock/af_vsock.c | |
parent | ee0b3843a26920dad713c27cd8f3a3cfc5ae9c37 (diff) | |
download | linux-stable-f2fdcf67aceb1a7d5e0661cb7ca95cda68d3014a.tar.gz linux-stable-f2fdcf67aceb1a7d5e0661cb7ca95cda68d3014a.tar.bz2 linux-stable-f2fdcf67aceb1a7d5e0661cb7ca95cda68d3014a.zip |
vsock: add API call for data ready
This adds 'vsock_data_ready()' which must be called by transport to kick
sleeping data readers. It checks for SO_RCVLOWAT value before waking
user, thus preventing spurious wake ups. Based on 'tcp_data_ready()' logic.
Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/vmw_vsock/af_vsock.c')
-rw-r--r-- | net/vmw_vsock/af_vsock.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index 15171ba76cc3..ee418701cdee 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -882,6 +882,16 @@ s64 vsock_stream_has_space(struct vsock_sock *vsk) } EXPORT_SYMBOL_GPL(vsock_stream_has_space); +void vsock_data_ready(struct sock *sk) +{ + struct vsock_sock *vsk = vsock_sk(sk); + + if (vsock_stream_has_data(vsk) >= sk->sk_rcvlowat || + sock_flag(sk, SOCK_DONE)) + sk->sk_data_ready(sk); +} +EXPORT_SYMBOL_GPL(vsock_data_ready); + static int vsock_release(struct socket *sock) { __vsock_release(sock->sk, 0); |