virtio/vsock: don't use skbuff state to account credit
authorArseniy Krasnov <avkrasnov@sberdevices.ru>
Tue, 14 Mar 2023 11:05:48 +0000 (14:05 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 16 Mar 2023 17:28:23 +0000 (17:28 +0000)
commit077706165717686a2a6a71405fef036cd5b37ae0
treee877146d0f13096ecd9add1214769c816d18bdec
parentcd356010ce4c69ac7e1a40586112df24d22c6a4b
virtio/vsock: don't use skbuff state to account credit

'skb->len' can vary when we partially read the data, this complicates the
calculation of credit to be updated in 'virtio_transport_inc_rx_pkt()/
virtio_transport_dec_rx_pkt()'.

Also in 'virtio_transport_dec_rx_pkt()' we were miscalculating the
credit since 'skb->len' was redundant.

For these reasons, let's replace the use of skbuff state to calculate new
'rx_bytes'/'fwd_cnt' values with explicit value as input argument. This
makes code more simple, because it is not needed to change skbuff state
before each call to update 'rx_bytes'/'fwd_cnt'.

Fixes: 71dc9ec9ac7d ("virtio/vsock: replace virtio_vsock_pkt with sk_buff")
Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Acked-by: Bobby Eshleman <bobby.eshleman@bytedance.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/vmw_vsock/virtio_transport_common.c