virtio/vsock: fix logic which reduces credit update messages
authorArseniy Krasnov <avkrasnov@salutedevices.com>
Thu, 14 Dec 2023 12:52:28 +0000 (15:52 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 23:35:26 +0000 (15:35 -0800)
commit925c22d438350db9e5d669ce296f213328ced74e
tree4bd7842043ace1de23ccb7e5f80ee7fa20e57a91
parent7b32e63f881432bf30f282328b8e64c6aa494ba2
virtio/vsock: fix logic which reduces credit update messages

[ Upstream commit 93b80887668226180ea5f5349cc728ca6dc700ab ]

Add one more condition for sending credit update during dequeue from
stream socket: when number of bytes in the rx queue is smaller than
SO_RCVLOWAT value of the socket. This is actual for non-default value
of SO_RCVLOWAT (e.g. not 1) - idea is to "kick" peer to continue data
transmission, because we need at least SO_RCVLOWAT bytes in our rx
queue to wake up user for reading data (in corner case it is also
possible to stuck both tx and rx sides, this is why 'Fixes' is used).

Fixes: b89d882dc9fc ("vsock/virtio: reduce credit update messages")
Signed-off-by: Arseniy Krasnov <avkrasnov@salutedevices.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/vmw_vsock/virtio_transport_common.c