diff options
| author | David S. Miller <davem@davemloft.net> | 2021-06-11 23:32:47 +0300 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2021-06-11 23:32:47 +0300 |
| commit | 5aa3bd9bc19e687e884f5da348a0d117b6ed1f04 (patch) | |
| tree | 931dad375142b264b57994224aed62a4e9457027 /include/linux | |
| parent | 57806b28752b778d7daeabcf4719f7522631a778 (diff) | |
| parent | 184039eefeaeab02abf7552504d2950dccf8785b (diff) | |
| download | linux-5aa3bd9bc19e687e884f5da348a0d117b6ed1f04.tar.xz | |
Merge branch 'virtio-vsock-seqpacket'
Arseny Krasnov says:
====================
virtio/vsock: introduce SOCK_SEQPACKET support
This patchset implements support of SOCK_SEQPACKET for virtio
transport.
As SOCK_SEQPACKET guarantees to save record boundaries, so to
do it, new bit for field 'flags' was added: SEQ_EOR. This bit is
set to 1 in last RW packet of message.
Now as packets of one socket are not reordered neither on vsock
nor on vhost transport layers, such bit allows to restore original
message on receiver's side. If user's buffer is smaller than message
length, when all out of size data is dropped.
Maximum length of datagram is limited by 'peer_buf_alloc' value.
Implementation also supports 'MSG_TRUNC' flags.
Tests also implemented.
Thanks to stsp2@yandex.ru for encouragements and initial design
recommendations.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/virtio_vsock.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h index dc636b727179..35d7eedb5e8e 100644 --- a/include/linux/virtio_vsock.h +++ b/include/linux/virtio_vsock.h @@ -36,6 +36,7 @@ struct virtio_vsock_sock { u32 rx_bytes; u32 buf_alloc; struct list_head rx_queue; + u32 msg_count; }; struct virtio_vsock_pkt { @@ -80,8 +81,17 @@ virtio_transport_dgram_dequeue(struct vsock_sock *vsk, struct msghdr *msg, size_t len, int flags); +int +virtio_transport_seqpacket_enqueue(struct vsock_sock *vsk, + struct msghdr *msg, + size_t len); +ssize_t +virtio_transport_seqpacket_dequeue(struct vsock_sock *vsk, + struct msghdr *msg, + int flags); s64 virtio_transport_stream_has_data(struct vsock_sock *vsk); s64 virtio_transport_stream_has_space(struct vsock_sock *vsk); +u32 virtio_transport_seqpacket_has_data(struct vsock_sock *vsk); int virtio_transport_do_socket_init(struct vsock_sock *vsk, struct vsock_sock *psk); |
