Message ID | 1ea0c407-814f-38a0-1fb7-4f146e5643ba@sberdevices.ru (mailing list archive) |
---|---|
State | Accepted |
Commit | e3ec366eb0d1d5f7cbe28e747c76180f7d45f00d |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | allocate multiple skbuffs on tx | expand |
diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c index 9e87c7d4d7cf..312658c176bd 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c @@ -302,6 +302,9 @@ u32 virtio_transport_get_credit(struct virtio_vsock_sock *vvs, u32 credit) { u32 ret; + if (!credit) + return 0; + spin_lock_bh(&vvs->tx_lock); ret = vvs->peer_buf_alloc - (vvs->tx_cnt - vvs->peer_fwd_cnt); if (ret > credit) @@ -315,6 +318,9 @@ EXPORT_SYMBOL_GPL(virtio_transport_get_credit); void virtio_transport_put_credit(struct virtio_vsock_sock *vvs, u32 credit) { + if (!credit) + return; + spin_lock_bh(&vvs->tx_lock); vvs->tx_cnt -= credit; spin_unlock_bh(&vvs->tx_lock);