Skip to contentSkip to conversation

VSOCK: handle VIRTIO_VSOCK_OP_CREDIT_REQUEST

PATCH Applied Harshavardhan Unnibhavi 4 participants 4 messages Aug 2, 2021 – Aug 3, 2021

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 VSOCK: handle VIRTIO_VSOCK_OP_CREDIT_REQUEST

The original implementation of the virtio-vsock driver does not handle a VIRTIO_VSOCK_OP_CREDIT_REQUEST as required by the virtio-vsock specification. The vsock device emulated by vhost-vsock and the virtio-vsock driver never uses this request, which was probably why nobody noticed it. However, another implementation of the device may use this request type.

Hence, this commit introduces a way to handle an explicit credit request by responding with a corresponding credit update as required by the virtio-vsock specification.

Fixes 06a8fc78367d ("VSOCK: Introduce virtio_vsock_common.ko")
---
 net/vmw_vsock/virtio_transport_common.c | 3 +++
 1 file changed, 3 insertions(+)
net/vmw_vsock/virtio_transport_common.c +3 -0
index 169ba8b72a63..081e7ae93cb1 100644
@@ -1079,6 +1079,9 @@ virtio_transport_recv_connected(struct sock *sk,
 		virtio_transport_recv_enqueue(vsk, pkt);
 		sk->sk_data_ready(sk);
 		return err;
+	case VIRTIO_VSOCK_OP_CREDIT_REQUEST:
+		virtio_transport_send_credit_update(vsk);
+		break;
 	case VIRTIO_VSOCK_OP_CREDIT_UPDATE:
 		sk->sk_write_space(sk);
 		break;
Signature · 1 line
2.17.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 24 lines · Harshavardhan Unnibhavi

The original implementation of the virtio-vsock driver does not handle a VIRTIO_VSOCK_OP_CREDIT_REQUEST as required by the virtio-vsock specification. The vsock device emulated by vhost-vsock and the virtio-vsock driver never uses this request, which was probably why nobody noticed it. However, another implementation of the device may use this request type.

Hence, this commit introduces a way to handle an explicit credit request by responding with a corresponding credit update as required by the virtio-vsock specification.

Fixes 06a8fc78367d ("VSOCK: Introduce virtio_vsock_common.ko")

---
net/vmw_vsock/virtio_transport_common.c | 3 +++

1 file changed, 3 insertions(+)
net/vmw_vsock/virtio_transport_common.c +0 -0
index 169ba8b72a63..081e7ae93cb1 100644

net/vmw_vsock/virtio_transport_common.c virtio_transport_recv_connected(struct sock *sk,

Quoted 10 lines
net/vmw_vsock/virtio_transport_common.c +3 -1
@@ -1079,6 +1079,9 @@ virtio_transport_recv_connected(struct sock *sk,
 		virtio_transport_recv_enqueue(vsk, pkt);
 		sk->sk_data_ready(sk);
 		return err;
+	case VIRTIO_VSOCK_OP_CREDIT_REQUEST:
+		virtio_transport_send_credit_update(vsk);
+		break;
 	case VIRTIO_VSOCK_OP_CREDIT_UPDATE:
 		sk->sk_write_space(sk);
 		break;
-- 2.17.1

The patch LGTM, thanks for fixing this long-time issue!

maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Harshavardhan Unnibhavi
Quoted 7 lines · Harshavardhan Unnibhavi

The original implementation of the virtio-vsock driver does not handle a VIRTIO_VSOCK_OP_CREDIT_REQUEST as required by the virtio-vsock specification. The vsock device emulated by vhost-vsock and the virtio-vsock driver never uses this request, which was probably why nobody noticed it. However, another implementation of the device may use this request type.

Quoted 7 lines

Hence, this commit introduces a way to handle an explicit credit request by responding with a corresponding credit update as required by the virtio-vsock specification.

Fixes 06a8fc78367d ("VSOCK: Introduce virtio_vsock_common.ko")
Quoted 20 lines
---
 net/vmw_vsock/virtio_transport_common.c | 3 +++
 1 file changed, 3 insertions(+)
net/vmw_vsock/virtio_transport_common.c +3 -0
index 169ba8b72a63..081e7ae93cb1 100644
@@ -1079,6 +1079,9 @@ virtio_transport_recv_connected(struct sock *sk,
 		virtio_transport_recv_enqueue(vsk, pkt);
 		sk->sk_data_ready(sk);
 		return err;
+	case VIRTIO_VSOCK_OP_CREDIT_REQUEST:
+		virtio_transport_send_credit_update(vsk);
+		break;
 	case VIRTIO_VSOCK_OP_CREDIT_UPDATE:
 		sk->sk_write_space(sk);
 		break;
Signature · 1 line
2.17.1
#3 lore raw
In reply to Harshavardhan Unnibhavi
This patch was applied to netdev/net.git (refs/heads/master):

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

Quoted 8 lines · On Mon, 2 Aug 2021 19:35:06 +0200 you wrote:

The original implementation of the virtio-vsock driver does not handle a VIRTIO_VSOCK_OP_CREDIT_REQUEST as required by the virtio-vsock specification. The vsock device emulated by vhost-vsock and the virtio-vsock driver never uses this request, which was probably why nobody noticed it. However, another implementation of the device may use this request type.

[...]

Here is the summary with links:
- [net] VSOCK: handle VIRTIO_VSOCK_OP_CREDIT_REQUEST

    https://git.kernel.org/netdev/net/c/e3ea110d6e79

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html