Re: [RFC PATCH v4 07/17] af_vsock: rest of SEQPACKET support

2021-02-15 Thread Arseny Krasnov
On 11.02.2021 15:27, Stefano Garzarella wrote: > On Sun, Feb 07, 2021 at 06:16:12PM +0300, Arseny Krasnov wrote: >> This does rest of SOCK_SEQPACKET support: >> 1) Adds socket ops for SEQPACKET type. >> 2) Allows to create socket with SEQPACKET type. >> >&

Re: [RFC PATCH v4 02/17] af_vsock: separate wait data loop

2021-02-15 Thread Arseny Krasnov
On 11.02.2021 18:11, Jorgen Hansen wrote: >> On 7 Feb 2021, at 16:14, Arseny Krasnov wrote: >> >> This moves wait loop for data to dedicated function, because later >> it will be used by SEQPACKET data receive loop. >> >> Signed-off-by: Arseny Krasnov >

Re: [RFC PATCH v4 00/17] virtio/vsock: introduce SOCK_SEQPACKET support

2021-02-11 Thread Arseny Krasnov
On 11.02.2021 17:57, Stefano Garzarella wrote: > Hi Arseny, > > On Mon, Feb 08, 2021 at 09:32:59AM +0300, Arseny Krasnov wrote: >> On 07.02.2021 19:20, Michael S. Tsirkin wrote: >>> On Sun, Feb 07, 2021 at 06:12:56PM +0300, Arseny Krasnov wrote: >>>>

Re: [RFC PATCH v5 00/19] virtio/vsock: introduce SOCK_SEQPACKET support

2021-02-23 Thread Arseny Krasnov
On 23.02.2021 17:50, Stefano Garzarella wrote: > On Mon, Feb 22, 2021 at 03:23:11PM +0100, Stefano Garzarella wrote: >> Hi Arseny, >> >> On Thu, Feb 18, 2021 at 08:33:44AM +0300, Arseny Krasnov wrote: >>> This patchset impelements support of SOCK_SEQP

Re: [RFC PATCH v5 11/19] virtio/vsock: dequeue callback for SOCK_SEQPACKET

2021-02-23 Thread Arseny Krasnov
On 23.02.2021 17:17, Michael S. Tsirkin wrote: > On Thu, Feb 18, 2021 at 08:39:37AM +0300, Arseny Krasnov wrote: >> This adds transport callback and it's logic for SEQPACKET dequeue. >> Callback fetches RW packets from rx queue of socket until whole record >> is copie

Re: [RFC PATCH v5 00/19] virtio/vsock: introduce SOCK_SEQPACKET support

2021-02-24 Thread Arseny Krasnov
On 24.02.2021 11:23, Stefano Garzarella wrote: > On Wed, Feb 24, 2021 at 07:29:25AM +0300, Arseny Krasnov wrote: >> On 23.02.2021 17:50, Stefano Garzarella wrote: >>> On Mon, Feb 22, 2021 at 03:23:11PM +0100, Stefano Garzarella wrote: >>>> Hi Arseny, >>>&g

Re: [RFC PATCH v5 00/19] virtio/vsock: introduce SOCK_SEQPACKET support

2021-02-24 Thread Arseny Krasnov
On 24.02.2021 11:35, Stefano Garzarella wrote: > On Wed, Feb 24, 2021 at 11:28:50AM +0300, Arseny Krasnov wrote: >> On 24.02.2021 11:23, Stefano Garzarella wrote: >>> On Wed, Feb 24, 2021 at 07:29:25AM +0300, Arseny Krasnov wrote: >>>> On 23.02.2021 17:50, Stefano

Re: [RFC PATCH v4 12/17] virtio/vsock: rest of SOCK_SEQPACKET support

2021-02-11 Thread Arseny Krasnov
On 07.02.2021 18:17, Arseny Krasnov wrote: > This adds rest of logic for SEQPACKET: > 1) Packet's type is now set in 'virtio_send_pkt_info()' using >type of socket. > 2) SEQPACKET specific functions which send SEQ_BEGIN/SEQ_END. >Note that both functions

[RFC PATCH v5 01/19] af_vsock: update functions for connectible socket

2021-02-17 Thread Arseny Krasnov
This prepares af_vsock.c for SEQPACKET support: some functions such as setsockopt(), getsockopt(), connect(), recvmsg(), sendmsg() are shared between both types of sockets, so rename them in general manner. Signed-off-by: Arseny Krasnov --- net/vmw_vsock/af_vsock.c | 64

[RFC PATCH v5 02/19] af_vsock: separate wait data loop

2021-02-17 Thread Arseny Krasnov
This moves wait loop for data to dedicated function, because later it will be used by SEQPACKET data receive loop. Signed-off-by: Arseny Krasnov --- net/vmw_vsock/af_vsock.c | 155 +-- 1 file changed, 83 insertions(+), 72 deletions(-) diff --git a/net

[RFC PATCH v5 00/19] virtio/vsock: introduce SOCK_SEQPACKET support

2021-02-17 Thread Arseny Krasnov
t is that user is not woken up until whole record is received or error occurred. Implementation also supports 'MSG_EOR' and 'MSG_TRUNC' flags. Tests also implemented. Arseny Krasnov (19): af_vsock: update functions for connectible socket af_vsock: separate wai

[RFC PATCH v5 03/19] af_vsock: separate receive data loop

2021-02-17 Thread Arseny Krasnov
This moves STREAM specific data receive logic to dedicated function: '__vsock_stream_recvmsg()', while checks that will be same for both types of socket are in shared function: 'vsock_connectible_recvmsg()'. Signed-off-by: Arseny Krasnov --- net/vmw_vs

[RFC PATCH v5 05/19] af_vsock: separate wait space loop

2021-02-17 Thread Arseny Krasnov
so to avoid it, sender waits until enough space will be ready. Signed-off-by: Arseny Krasnov --- include/net/af_vsock.h | 2 + net/vmw_vsock/af_vsock.c | 99 +--- 2 files changed, 63 insertions(+), 38 deletions(-) diff --git a/include/net/af_vsock.h b/includ

[RFC PATCH v5 07/19] af_vsock: rest of SEQPACKET support

2021-02-17 Thread Arseny Krasnov
This does rest of SOCK_SEQPACKET support: 1) Adds socket ops for SEQPACKET type. 2) Allows to create socket with SEQPACKET type. Signed-off-by: Arseny Krasnov --- net/vmw_vsock/af_vsock.c | 36 +++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a

[RFC PATCH v5 04/19] af_vsock: implement SEQPACKET receive loop

2021-02-17 Thread Arseny Krasnov
in SEQPACKET case. 3) It waits until whole record is received or error is found during receiving. 4) It processes and sets 'MSG_TRUNC' flag. So to avoid extra conditions for two types of socket inside one loop, two independent functions were created. Signed-off-by: Arseny Krasnov ---

[RFC PATCH v5 06/19] af_vsock: implement send logic for SEQPACKET

2021-02-17 Thread Arseny Krasnov
This adds some logic to current stream enqueue function for SEQPACKET support: 1) Send record's begin/end marker. 2) Return value from enqueue function is whole record length or error for SOCK_SEQPACKET. Signed-off-by: Arseny Krasnov --- include/net/af_vsock.h | 2 ++ net/vmw_

[RFC PATCH v5 08/19] af_vsock: update comments for stream sockets

2021-02-17 Thread Arseny Krasnov
This replaces 'stream' to 'connect oriented' in comments as SEQPACKET is also connect oriented. Signed-off-by: Arseny Krasnov --- net/vmw_vsock/af_vsock.c | 31 +-- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/net/vmw_vs

[RFC PATCH v5 10/19] virtio/vsock: simplify credit update function API

2021-02-17 Thread Arseny Krasnov
'virtio_transport_send_credit_update()' has some extra args: 1) 'type' may be set in 'virtio_transport_send_pkt_info()' using type of socket. 2) This function is static and 'hdr' arg was always NULL. Signed-off-by: Arseny Krasnov --- net/

[RFC PATCH v5 09/19] virtio/vsock: set packet's type in send

2021-02-17 Thread Arseny Krasnov
This moves passing type of packet from 'info' srtucture to send function. There is no sense to set type of packet which differs from type of socket, and since at current time only stream type is supported, so force to use this type. Signed-off-by: Arseny Krasnov --- net

[RFC PATCH v5 11/19] virtio/vsock: dequeue callback for SOCK_SEQPACKET

2021-02-17 Thread Arseny Krasnov
ov iterator(previous unfinished data is dropped). Signed-off-by: Arseny Krasnov --- include/linux/virtio_vsock.h| 10 +++ include/uapi/linux/virtio_vsock.h | 16 net/vmw_vsock/virtio_transport_common.c | 114 3 files changed, 140 insertions(+)

[RFC PATCH v5 14/19] virtio/vsock: rest of SOCK_SEQPACKET support

2021-02-17 Thread Arseny Krasnov
packet type during send. 5) Set MSG_EOR in flags for SEQPACKET during send. Signed-off-by: Arseny Krasnov --- include/linux/virtio_vsock.h| 3 ++ net/vmw_vsock/virtio_transport_common.c | 67 - 2 files changed, 68 insertions(+), 2 deletions(-) diff --git a

[RFC PATCH v5 12/19] virtio/vsock: fetch length for SEQPACKET record

2021-02-17 Thread Arseny Krasnov
This adds transport callback which tries to fetch record begin marker from socket's rx queue. It is called from af_vsock.c before reading data packets of record. Signed-off-by: Arseny Krasnov --- include/linux/virtio_vsock.h| 1 + net/vmw_vsock/virtio_transport_common.c

[RFC PATCH v5 13/19] virtio/vsock: add SEQPACKET receive logic

2021-02-17 Thread Arseny Krasnov
n receive(if mismatch, then reset connection). Signed-off-by: Arseny Krasnov --- net/vmw_vsock/virtio_transport_common.c | 63 + 1 file changed, 44 insertions(+), 19 deletions(-) diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transpo

[RFC PATCH v5 17/19] vsock/loopback: setup SEQPACKET ops for transport

2021-02-17 Thread Arseny Krasnov
This adds SEQPACKET ops for loopback transport Signed-off-by: Arseny Krasnov --- net/vmw_vsock/vsock_loopback.c | 5 + 1 file changed, 5 insertions(+) diff --git a/net/vmw_vsock/vsock_loopback.c b/net/vmw_vsock/vsock_loopback.c index a45f7ffca8c5..c0da94119f74 100644 --- a/net/vmw_vsock

[RFC PATCH v5 15/19] virtio/vsock: setup SEQPACKET ops for transport

2021-02-17 Thread Arseny Krasnov
This adds SEQPACKET ops for virtio transport Signed-off-by: Arseny Krasnov --- net/vmw_vsock/virtio_transport.c | 5 + 1 file changed, 5 insertions(+) diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c index 2700a63ab095..bd3a854bb366 100644 --- a/net

[RFC PATCH v5 16/19] vhost/vsock: setup SEQPACKET ops for transport

2021-02-17 Thread Arseny Krasnov
This also removes ignore of non-stream type of packets. Signed-off-by: Arseny Krasnov --- drivers/vhost/vsock.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index 5e78fb719602..5c86d09e36d9 100644 --- a/drivers/vhost

[RFC PATCH v5 19/19] virtio/vsock: update trace event for SEQPACKET

2021-02-17 Thread Arseny Krasnov
This updates current implementation for trace event of virtio vsock: SEQPACKET socket's type, SEQPACKET specific ops and SEQPACKET 'msg_len' and 'msg_cnt' fields are added. Signed-off-by: Arseny Krasnov --- .../events/vsock_virtio_transport_common.h| 48 +

[RFC PATCH v5 18/19] vsock_test: add SOCK_SEQPACKET tests

2021-02-17 Thread Arseny Krasnov
This adds two tests of SOCK_SEQPACKET socket: both transfer data and then test MSG_EOR and MSG_TRUNC flags. Cases for connect(), bind(), etc. are not tested, because it is same as for stream socket. Signed-off-by: Arseny Krasnov --- tools/testing/vsock/util.c | 32 ++-- tools/testing

Re: [RFC PATCH v3 03/13] af_vsock: implement SEQPACKET rx loop

2021-01-28 Thread Arseny Krasnov
On 28.01.2021 19:55, Stefano Garzarella wrote: > On Mon, Jan 25, 2021 at 02:12:36PM +0300, Arseny Krasnov wrote: >> This adds receive loop for SEQPACKET. It looks like receive loop for >> SEQPACKET, but there is a little bit difference: >> 1) It doesn't call notify c

Re: [RFC PATCH v3 00/13] virtio/vsock: introduce SOCK_SEQPACKET support

2021-01-28 Thread Arseny Krasnov
On 28.01.2021 20:19, Stefano Garzarella wrote: > Hi Arseny, > I reviewed a part, tomorrow I hope to finish the other patches. > > Just a couple of comments in the TODOs below. > > On Mon, Jan 25, 2021 at 02:09:00PM +0300, Arseny Krasnov wrote: >> This patchse

Re: [RFC PATCH v3 00/13] virtio/vsock: introduce SOCK_SEQPACKET support

2021-02-01 Thread Arseny Krasnov
On 01.02.2021 14:02, Stefano Garzarella wrote: > On Fri, Jan 29, 2021 at 06:52:23PM +0300, Arseny Krasnov wrote: >> On 29.01.2021 12:26, Stefano Garzarella wrote: >>> On Fri, Jan 29, 2021 at 09:41:50AM +0300, Arseny Krasnov wrote: >>>> On 28.01.2021 20:19, Stef

Re: [RFC PATCH v3 00/13] virtio/vsock: introduce SOCK_SEQPACKET support

2021-02-01 Thread Arseny Krasnov
On 01.02.2021 17:23, Stefano Garzarella wrote: > On Mon, Feb 01, 2021 at 04:57:18PM +0300, Arseny Krasnov wrote: >> On 01.02.2021 14:02, Stefano Garzarella wrote: >>> On Fri, Jan 29, 2021 at 06:52:23PM +0300, Arseny Krasnov wrote: >>>> On 29.01.2021 12:26, Stefano

Re: [RFC PATCH v5 04/19] af_vsock: implement SEQPACKET receive loop

2021-02-25 Thread Arseny Krasnov
On 25.02.2021 19:27, Jorgen Hansen wrote: > On 18 Feb 2021, at 06:37, Arseny Krasnov wrote: >> This adds receive loop for SEQPACKET. It looks like receive loop for >> STREAM, but there is a little bit difference: >> 1) It doesn't call notify callbacks. >> 2) It

Re: [RFC PATCH v5 02/19] af_vsock: separate wait data loop

2021-02-25 Thread Arseny Krasnov
On 25.02.2021 17:24, Jorgen Hansen wrote: >> On 18 Feb 2021, at 06:36, Arseny Krasnov >> wrote: >> >> This moves wait loop for data to dedicated function, because later >> it will be used by SEQPACKET data receive loop. >> >> Signed-off-by: Arseny K

Re: [RFC PATCH v5 11/19] virtio/vsock: dequeue callback for SOCK_SEQPACKET

2021-02-27 Thread Arseny Krasnov
On 24.02.2021 09:41, Michael S. Tsirkin wrote: > On Wed, Feb 24, 2021 at 08:07:48AM +0300, Arseny Krasnov wrote: >> On 23.02.2021 17:17, Michael S. Tsirkin wrote: >>> On Thu, Feb 18, 2021 at 08:39:37AM +0300, Arseny Krasnov wrote: >>>> This adds transport callbac

Re: [PATCH 3/5] af_vsock: send/receive loops for SOCK_SEQPACKET.

2021-01-10 Thread Arseny Krasnov
> Hmm, are you sure you need to convert > "err" to the pointer, just to return true/false > as the return value? > How about still returning "err" itself? In this case i need to reserve some value for "err" as success, because both 0 and negative values are passed to caller when this function retu

[RFC PATCH v2 00/13] virtio/vsock: introduce SOCK_SEQPACKET support.

2021-01-14 Thread Arseny Krasnov
er is not woken up until whole record is received or error occurred. Implementation also supports 'MSG_EOR' and 'MSG_TRUNC' flags. Tests also implemented. Arseny Krasnov (13): af_vsock: implement 'vsock_wait_data()'. af_vsock: separate rx loops for STREAM/SEQP

[RFC PATCH v2 01/13] af_vsock: implement 'vsock_wait_data()'.

2021-01-14 Thread Arseny Krasnov
Signed-off-by: Arseny Krasnov --- net/vmw_vsock/af_vsock.c | 47 1 file changed, 47 insertions(+) diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index b12d3a322242..af716f5a93a4 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_v

[RFC PATCH v2 03/13] af_vsock: implement rx loops entry point

2021-01-14 Thread Arseny Krasnov
This adds entry point for STREAM/SEQPACKET rx loops. As both types are connect oriented, so there are same checks before reading data from socket. All this checks are performed in this entry point, then specific rx loop is called. Signed-off-by: Arseny Krasnov --- net/vmw_vsock/af_vsock.c | 55

[RFC PATCH v2 04/13] af_vsock: replace previous stream rx loop.

2021-01-14 Thread Arseny Krasnov
This removes previous 'vsock_stream_recvmsg()' and uses newly implemented receive loops. Moved to separate patch to make review easier. Signed-off-by: Arseny Krasnov --- net/vmw_vsock/af_vsock.c | 184 +++ 1 file changed, 12 insertions(+), 172

[RFC PATCH v2 02/13] af_vsock: separate rx loops for STREAM/SEQPACKET.

2021-01-14 Thread Arseny Krasnov
s no sense for these values in SEQPACKET case. 3) It waits until whole record is received or error is found during receiving. 4) It processes and sets 'MSG_TRUNC' flag. So to avoid extra conditions for two types of socket inside on loop, two independent functions were created. Signed-

[RFC PATCH v2 06/13] af_vsock: general support of SOCK_SEQPACKET type.

2021-01-14 Thread Arseny Krasnov
This adds socket operations for SOCK_SEQPACKET and adds this type of socket for conditions where SOCK_STREAM is involved because both type of sockets are connect oriented. Signed-off-by: Arseny Krasnov --- net/vmw_vsock/af_vsock.c | 108 +-- 1 file changed

[RFC PATCH v2 07/13] af_vsock: update comments for stream sockets.

2021-01-14 Thread Arseny Krasnov
This replaces 'stream' to 'connect oriented' in comments as SEQPACKET is also connect oriented. Signed-off-by: Arseny Krasnov --- net/vmw_vsock/af_vsock.c | 31 +-- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/net/vmw_vs

[RFC PATCH v2 05/13] af_vsock: implement send logic for SOCK_SEQPACKET

2021-01-14 Thread Arseny Krasnov
This adds some logic to current stream enqueue function for SEQPACKET support: 1) Send record begin marker with length of record. 2) Return value from enqueue function is wholevrecord length or error for SOCK_SEQPACKET. Signed-off-by: Arseny Krasnov --- include/net/af_vsock.h | 1 + net

[RFC PATCH v2 08/13] virtio/vsock: dequeue callback for SOCK_SEQPACKET.

2021-01-14 Thread Arseny Krasnov
ov iterator(previous unfinished data is dropped). Signed-off-by: Arseny Krasnov --- include/linux/virtio_vsock.h| 4 + include/uapi/linux/virtio_vsock.h | 9 ++ net/vmw_vsock/virtio_transport_common.c | 128 3 files changed, 141 insertions(+) diff -

[RFC PATCH v2 11/13] virtio/vsock: rest of SOCK_SEQPACKET support

2021-01-14 Thread Arseny Krasnov
send whole record to TAP interface. This could be done by allocating new packet when whole record is received, data of record must be copied to TAP packet. Signed-off-by: Arseny Krasnov --- include/linux/virtio_vsock.h| 7 net/vmw_vsock/virtio_transport.c| 4

[RFC PATCH v2 09/13] virtio/vsock: implement fetch of record length

2021-01-14 Thread Arseny Krasnov
This adds transport callback which tries to fetch record begin marker from socket's rx queue. It is called from af_vsock.c before reading data packets of record. Signed-off-by: Arseny Krasnov --- include/linux/virtio_vsock.h| 1 + net/vmw_vsock/virtio_transport_common.c

[RFC PATCH v2 10/13] virtio/vsock: update receive logic

2021-01-14 Thread Arseny Krasnov
then reset connection). Signed-off-by: Arseny Krasnov --- net/vmw_vsock/virtio_transport_common.c | 79 ++--- 1 file changed, 58 insertions(+), 21 deletions(-) diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c index fe1272e7

[RFC PATCH v2 12/13] vhost/vsock: support for SOCK_SEQPACKET socket.

2021-01-14 Thread Arseny Krasnov
This adds transport ops and removes ignore of non-stream type of packets. Signed-off-by: Arseny Krasnov --- drivers/vhost/vsock.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index 5e78fb719602..4d60a99aed14 100644

[RFC PATCH v2 13/13] vsock_test: add SOCK_SEQPACKET tests.

2021-01-14 Thread Arseny Krasnov
This adds two tests of SOCK_SEQPACKET socket: both transfer data and then test MSG_EOR and MSG_TRUNC flags. Cases for connect(), bind(), etc. are not tested, because it is same as for stream socket. Signed-off-by: Arseny Krasnov --- tools/testing/vsock/util.c | 32 ++-- tools

[PATCH 1/3] vsock/virtio: support for SOCK_SEQPACKET socket.

2020-12-29 Thread Arseny Krasnov
' flag is implemented with special value of 'flags' field in packet header. When record is received with such flags, 'MSG_EOR' is set in 'recvmsg()' flags. Signed-off-by: Arseny Krasnov --- include/linux/virtio_vsock.h| 7 + include/net/af_vsock.h

[PATCH 2/3] vhost/vsock: support for SOCK_SEQPACKET socket.

2020-12-29 Thread Arseny Krasnov
This patch simply adds transport ops and removes ignore of non-stream type of packets. Signed-off-by: Arseny Krasnov --- drivers/vhost/vsock.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index a483cec31d5c

[PATCH 3/3] vsock: support for SOCK_SEQPACKET socket.

2020-12-29 Thread Arseny Krasnov
it waits until whole record is received or error in found during receiving and it takes care about 'MSG_TRUNC' flag. 3) Update some comments('stream' -> 'connect oriented'). Signed-off-by: Arseny Krasnov --- net/vmw_vsock/af_vsock.c | 4

Re: [RFC PATCH v7 04/22] af_vsock: implement SEQPACKET receive loop

2021-03-25 Thread Arseny Krasnov
On 25.03.2021 12:34, Stefano Garzarella wrote: > On Tue, Mar 23, 2021 at 04:10:03PM +0300, Arseny Krasnov wrote: >> This adds receive loop for SEQPACKET. It looks like receive loop for >> STREAM, but there is a little bit difference: >> 1) It doesn't call notify callba

Re: [RFC PATCH v7 11/22] virtio/vsock: dequeue callback for SOCK_SEQPACKET

2021-03-25 Thread Arseny Krasnov
On 25.03.2021 12:56, Stefano Garzarella wrote: > On Tue, Mar 23, 2021 at 04:12:41PM +0300, Arseny Krasnov wrote: >> This adds transport callback and it's logic for SEQPACKET dequeue. >> Callback fetches RW packets from rx queue of socket until whole record >> is copie

Re: [RFC PATCH v7 12/22] virtio/vsock: fetch length for SEQPACKET record

2021-03-25 Thread Arseny Krasnov
On 25.03.2021 13:08, Stefano Garzarella wrote: > On Tue, Mar 23, 2021 at 04:12:55PM +0300, Arseny Krasnov wrote: >> This adds transport callback which tries to fetch record begin marker > >from socket's rx queue. It is called from af_vsock.c before reading data >> packe

Re: [RFC PATCH v7 14/22] virtio/vsock: rest of SOCK_SEQPACKET support

2021-03-25 Thread Arseny Krasnov
On 25.03.2021 13:18, Stefano Garzarella wrote: > On Tue, Mar 23, 2021 at 04:13:29PM +0300, Arseny Krasnov wrote: >> This adds rest of logic for SEQPACKET: >> 1) SEQPACKET specific functions which send SEQ_BEGIN/SEQ_END. >> Note that both functions may sleep to

Re: [RFC PATCH v7 15/22] virtio/vsock: SEQPACKET support feature bit

2021-03-25 Thread Arseny Krasnov
On 25.03.2021 13:26, Stefano Garzarella wrote: > On Tue, Mar 23, 2021 at 04:13:49PM +0300, Arseny Krasnov wrote: >> This adds new virtio vsock specific feature bit which means >> SOCK_SEQPACKET support. Guest negotiates this bit with vhost, >> thus checking that vhost si

Re: [RFC PATCH v7 16/22] virtio/vsock: setup SEQPACKET ops for transport

2021-03-25 Thread Arseny Krasnov
On 25.03.2021 13:39, Stefano Garzarella wrote: > On Tue, Mar 23, 2021 at 04:14:03PM +0300, Arseny Krasnov wrote: >> This adds SEQPACKET ops for virtio transport and 'seqpacket_allow()' >> callback. >> >> Signed-off-by: Arseny Krasnov >> -

Re: [RFC PATCH v7 17/22] vhost/vsock: setup SEQPACKET ops for transport

2021-03-25 Thread Arseny Krasnov
On 25.03.2021 13:42, Stefano Garzarella wrote: > On Tue, Mar 23, 2021 at 04:14:18PM +0300, Arseny Krasnov wrote: >> This also removes ignore of non-stream type of packets and adds >> 'seqpacket_allow()' callback. >> >> Signed-off-by: Arseny Krasnov

Re: [RFC PATCH v7 00/22] virtio/vsock: introduce SOCK_SEQPACKET support

2021-03-25 Thread Arseny Krasnov
On 25.03.2021 13:52, Stefano Garzarella wrote: > Hi Arseny, > > On Tue, Mar 23, 2021 at 04:07:13PM +0300, Arseny Krasnov wrote: >> This patchset implements support of SOCK_SEQPACKET for virtio >> transport. >> As SOCK_SEQPACKET guarantees to save record boun

[RFC PATCH v7 00/22] virtio/vsock: introduce SOCK_SEQPACKET support

2021-03-23 Thread Arseny Krasnov
supports 'MSG_EOR' and 'MSG_TRUNC' flags. Tests also implemented. Thanks to st...@yandex.ru for encouragements and initial design recommendations. Arseny Krasnov (22): af_vsock: update functions for connectible socket af_vsock: separate wait data loop

[RFC PATCH v7 01/22] af_vsock: update functions for connectible socket

2021-03-23 Thread Arseny Krasnov
This prepares af_vsock.c for SEQPACKET support: some functions such as setsockopt(), getsockopt(), connect(), recvmsg(), sendmsg() are shared between both types of sockets, so rename them in general manner. Signed-off-by: Arseny Krasnov Reviewed-by: Stefano Garzarella --- net/vmw_vsock

[RFC PATCH v7 02/22] af_vsock: separate wait data loop

2021-03-23 Thread Arseny Krasnov
This moves wait loop for data to dedicated function, because later it will be used by SEQPACKET data receive loop. While moving the code around, let's update an old comment. Signed-off-by: Arseny Krasnov Reviewed-by: Stefano Garzarella --- net/vmw_vsock/af_vsock.c

[RFC PATCH v7 03/22] af_vsock: separate receive data loop

2021-03-23 Thread Arseny Krasnov
Move STREAM specific data receive logic to '__vsock_stream_recvmsg()' dedicated function, while checks, that will be same for both STREAM and SEQPACKET sockets, stays in 'vsock_connectible_recvmsg()' shared functions. Signed-off-by: Arseny Krasnov --- net/vmw_vs

[RFC PATCH v7 04/22] af_vsock: implement SEQPACKET receive loop

2021-03-23 Thread Arseny Krasnov
in SEQPACKET case. 3) It waits until whole record is received or error is found during receiving. 4) It processes and sets 'MSG_TRUNC' flag. So to avoid extra conditions for two types of socket inside one loop, two independent functions were created. Signed-off-by: Arseny Krasnov --- v6

[RFC PATCH v7 05/22] af_vsock: separate wait space loop

2021-03-23 Thread Arseny Krasnov
so to avoid it, sender waits until enough space will be ready. Signed-off-by: Arseny Krasnov --- include/net/af_vsock.h | 2 + net/vmw_vsock/af_vsock.c | 99 +--- 2 files changed, 63 insertions(+), 38 deletions(-) diff --git a/include/net/af_vsock.h b/includ

[RFC PATCH v7 06/22] af_vsock: implement send logic for SEQPACKET

2021-03-23 Thread Arseny Krasnov
This adds some logic to current stream enqueue function for SEQPACKET support: 1) Use transport's seqpacket enqueue callback. 2) Return value from enqueue function is whole record length or error for SOCK_SEQPACKET. Signed-off-by: Arseny Krasnov --- v6 -> v7: 'seqpacket_enqu

[RFC PATCH v7 07/22] af_vsock: rest of SEQPACKET support

2021-03-23 Thread Arseny Krasnov
This does rest of SOCK_SEQPACKET support: 1) Adds socket ops for SEQPACKET type. 2) Allows to create socket with SEQPACKET type. Signed-off-by: Arseny Krasnov Reviewed-by: Stefano Garzarella --- include/net/af_vsock.h | 1 + net/vmw_vsock/af_vsock.c | 36

[RFC PATCH v7 08/22] af_vsock: update comments for stream sockets

2021-03-23 Thread Arseny Krasnov
This replaces 'stream' to 'connection oriented' in comments as SEQPACKET is also connection oriented. Signed-off-by: Arseny Krasnov Reviewed-by: Stefano Garzarella --- net/vmw_vsock/af_vsock.c | 31 +-- 1 file changed, 17 insertions(+), 14 deleti

[RFC PATCH v7 09/22] virtio/vsock: set packet's type in virtio_transport_send_pkt_info()

2021-03-23 Thread Arseny Krasnov
ort_send_ pkt_info()', so callers don't need to set it. Signed-off-by: Arseny Krasnov Reviewed-by: Stefano Garzarella --- net/vmw_vsock/virtio_transport_common.c | 19 +-- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/net/vmw_vsock/virtio_

[RFC PATCH v7 10/22] virtio/vsock: simplify credit update function API

2021-03-23 Thread Arseny Krasnov
This function is static and 'hdr' arg was always NULL. Signed-off-by: Arseny Krasnov Reviewed-by: Stefano Garzarella --- net/vmw_vsock/virtio_transport_common.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/net/vmw_vsock/virtio_transport_common.c b/net

[RFC PATCH v7 12/22] virtio/vsock: fetch length for SEQPACKET record

2021-03-23 Thread Arseny Krasnov
This adds transport callback which tries to fetch record begin marker from socket's rx queue. It is called from af_vsock.c before reading data packets of record. Signed-off-by: Arseny Krasnov --- v6 -> v7: 1) Now 'virtio_transport_seqpacket_seq_get_len()' returns 0, if rx

[RFC PATCH v7 11/22] virtio/vsock: dequeue callback for SOCK_SEQPACKET

2021-03-23 Thread Arseny Krasnov
ov iterator(previous unfinished data is dropped). Signed-off-by: Arseny Krasnov --- v6 -> v7: 1) 'struct virtio_vsock_seqpacket_state' now renamed to 'struct virtio_vsock_seq_state'. 2) Field 'seqpacket_state' of 'struct virtio_vsock_sock' now

[RFC PATCH v7 13/22] virtio/vsock: add SEQPACKET receive logic

2021-03-23 Thread Arseny Krasnov
n receive(if mismatch, then reset connection). Signed-off-by: Arseny Krasnov --- v6 -> v7: In 'virtio_transport_recv_pkt()', 'sock_put()' is added, when type of received packet does not match to the type of socket. net/vmw_vsock/virtio_transport_common.c | 64 ++

[RFC PATCH v7 16/22] virtio/vsock: setup SEQPACKET ops for transport

2021-03-23 Thread Arseny Krasnov
This adds SEQPACKET ops for virtio transport and 'seqpacket_allow()' callback. Signed-off-by: Arseny Krasnov --- net/vmw_vsock/virtio_transport.c | 12 1 file changed, 12 insertions(+) diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transpo

[RFC PATCH v7 14/22] virtio/vsock: rest of SOCK_SEQPACKET support

2021-03-23 Thread Arseny Krasnov
packet type during send. 5) Set MSG_EOR in flags for SEQPACKET during send. 6) 'seqpacket_allow' flag to virtio transport. Signed-off-by: Arseny Krasnov --- v6 -> v7: In 'virtio_transport_seqpacket_enqueue()', 'next_tx_msg_id' is updated in both cases when m

[RFC PATCH v7 15/22] virtio/vsock: SEQPACKET support feature bit

2021-03-23 Thread Arseny Krasnov
This adds new virtio vsock specific feature bit which means SOCK_SEQPACKET support. Guest negotiates this bit with vhost, thus checking that vhost side supports SEQPACKET. Signed-off-by: Arseny Krasnov --- include/uapi/linux/virtio_vsock.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a

[RFC PATCH v7 17/22] vhost/vsock: setup SEQPACKET ops for transport

2021-03-23 Thread Arseny Krasnov
This also removes ignore of non-stream type of packets and adds 'seqpacket_allow()' callback. Signed-off-by: Arseny Krasnov --- drivers/vhost/vsock.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vso

[RFC PATCH v7 18/22] vsock/loopback: setup SEQPACKET ops for transport

2021-03-23 Thread Arseny Krasnov
This adds SEQPACKET ops for loopback transport and 'seqpacket_allow()' callback. Signed-off-by: Arseny Krasnov --- net/vmw_vsock/vsock_loopback.c | 12 1 file changed, 12 insertions(+) diff --git a/net/vmw_vsock/vsock_loopback.c b/net/vmw_vsock/vsock_loopback.c index a4

[RFC PATCH v7 19/22] vhost/vsock: SEQPACKET feature bit support

2021-03-23 Thread Arseny Krasnov
This adds handling of SEQPACKET bit: if guest sets features with this bit cleared, then SOCK_SEQPACKET support will be disabled. Signed-off-by: Arseny Krasnov --- drivers/vhost/vsock.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/vsock.c b/drivers/vhost

[RFC PATCH v7 20/22] virtio/vsock: SEQPACKET feature bit support

2021-03-23 Thread Arseny Krasnov
This adds handling of SEQPACKET bit: guest tries to negotiate it with vhost. Signed-off-by: Arseny Krasnov --- net/vmw_vsock/virtio_transport.c | 5 + 1 file changed, 5 insertions(+) diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c index 83ae2078c847

[RFC PATCH v7 21/22] vsock_test: add SOCK_SEQPACKET tests

2021-03-23 Thread Arseny Krasnov
This adds two tests of SOCK_SEQPACKET socket: both transfer data and then test MSG_EOR and MSG_TRUNC flags. Cases for connect(), bind(), etc. are not tested, because it is same as for stream socket. Signed-off-by: Arseny Krasnov --- tools/testing/vsock/util.c | 32 ++-- tools/testing

[RFC PATCH v7 22/22] virtio/vsock: update trace event for SEQPACKET

2021-03-23 Thread Arseny Krasnov
This updates current implementation for trace event of virtio vsock: SEQPACKET socket's type, SEQPACKET specific ops and SEQPACKET 'msg_len' and 'msg_id' fields are added. Signed-off-by: Arseny Krasnov --- .../events/vsock_virtio_transport_common.h| 48 +

Re: [RFC PATCH v5 19/19] virtio/vsock: update trace event for SEQPACKET

2021-03-03 Thread Arseny Krasnov
On 03.03.2021 01:25, Steven Rostedt wrote: > On Thu, 18 Feb 2021 08:42:15 +0300 > Arseny Krasnov wrote: > > Not sure if this was pulled in yet, but I do have a small issue with this > patch. No, it is in RFC state. > >> @@ -69,14 +82,19 @@ TRACE_EVENT(vi

Re: [RFC PATCH v6 00/22] virtio/vsock: introduce SOCK_SEQPACKET support

2021-03-15 Thread Arseny Krasnov
On 15.03.2021 18:22, Arseny Krasnov wrote: > On 15.03.2021 14:40, Stefano Garzarella wrote: >> Hi Arseny, >> >> On Sun, Mar 07, 2021 at 08:57:19PM +0300, Arseny Krasnov wrote: >>> This patchset implements support of SOCK_SEQPACKET for virtio >>&g

[RFC PATCH v8 00/19] virtio/vsock: introduce SOCK_SEQPACKET support

2021-04-13 Thread Arseny Krasnov
initial design recommendations. Arseny Krasnov (19): af_vsock: update functions for connectible socket af_vsock: separate wait data loop af_vsock: separate receive data loop af_vsock: implement SEQPACKET receive loop af_vsock: implement send logic for SEQPACKET af_vsock: rest of SEQPAC

[RFC PATCH v8 01/19] af_vsock: update functions for connectible socket

2021-04-13 Thread Arseny Krasnov
This prepares af_vsock.c for SEQPACKET support: some functions such as setsockopt(), getsockopt(), connect(), recvmsg(), sendmsg() are shared between both types of sockets, so rename them in general manner. Signed-off-by: Arseny Krasnov Reviewed-by: Stefano Garzarella --- net/vmw_vsock

[RFC PATCH v8 02/19] af_vsock: separate wait data loop

2021-04-13 Thread Arseny Krasnov
This moves wait loop for data to dedicated function, because later it will be used by SEQPACKET data receive loop. While moving the code around, let's update an old comment. Signed-off-by: Arseny Krasnov Reviewed-by: Stefano Garzarella --- net/vmw_vsock/af_vsock.c

[RFC PATCH v8 03/19] af_vsock: separate receive data loop

2021-04-13 Thread Arseny Krasnov
Move STREAM specific data receive logic to '__vsock_stream_recvmsg()' dedicated function, while checks, that will be same for both STREAM and SEQPACKET sockets, stays in 'vsock_connectible_recvmsg()' shared functions. Signed-off-by: Arseny Krasnov Reviewed-by: Stefano

[RFC PATCH v8 04/19] af_vsock: implement SEQPACKET receive loop

2021-04-13 Thread Arseny Krasnov
in SEQPACKET case. 3) It waits until whole record is received or error is found during receiving. 4) It processes and sets 'MSG_TRUNC' flag. So to avoid extra conditions for two types of socket inside one loop, two independent functions were created. Signed-off-by: Arseny Krasnov --- v

[RFC PATCH v8 06/19] af_vsock: rest of SEQPACKET support

2021-04-13 Thread Arseny Krasnov
This does rest of SOCK_SEQPACKET support: 1) Adds socket ops for SEQPACKET type. 2) Allows to create socket with SEQPACKET type. Signed-off-by: Arseny Krasnov Reviewed-by: Stefano Garzarella --- include/net/af_vsock.h | 1 + net/vmw_vsock/af_vsock.c | 36

[RFC PATCH v8 05/19] af_vsock: implement send logic for SEQPACKET

2021-04-13 Thread Arseny Krasnov
This adds some logic to current stream enqueue function for SEQPACKET support: 1) Use transport's seqpacket enqueue callback. 2) Return value from enqueue function is whole record length or error for SOCK_SEQPACKET. Signed-off-by: Arseny Krasnov Reviewed-by: Stefano Garzarella --- in

[RFC PATCH v8 07/19] af_vsock: update comments for stream sockets

2021-04-13 Thread Arseny Krasnov
This replaces 'stream' to 'connection oriented' in comments as SEQPACKET is also connection oriented. Signed-off-by: Arseny Krasnov Reviewed-by: Stefano Garzarella --- net/vmw_vsock/af_vsock.c | 31 +-- 1 file changed, 17 insertions(+), 14 deleti

[RFC PATCH v8 09/19] virtio/vsock: simplify credit update function API

2021-04-13 Thread Arseny Krasnov
This function is static and 'hdr' arg was always NULL. Signed-off-by: Arseny Krasnov Reviewed-by: Stefano Garzarella --- net/vmw_vsock/virtio_transport_common.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/net/vmw_vsock/virtio_transport_common.c b/net

[RFC PATCH v8 08/19] virtio/vsock: set packet's type in virtio_transport_send_pkt_info()

2021-04-13 Thread Arseny Krasnov
ort_send_ pkt_info()', so callers don't need to set it. Signed-off-by: Arseny Krasnov Reviewed-by: Stefano Garzarella --- net/vmw_vsock/virtio_transport_common.c | 19 +-- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/net/vmw_vsock/virtio_

[RFC PATCH v8 10/19] virtio/vsock: defines and constants for SEQPACKET

2021-04-13 Thread Arseny Krasnov
This adds set of defines and constants for SOCK_SEQPACKET support in vsock. Signed-off-by: Arseny Krasnov --- v7 -> v8: - Things like SEQ_BEGIN, SEQ_END, 'msg_len' and 'msg_id' now removed. Now only last RW packet of each message marked by 'VIRTIO_VSOCK_SEQ_EOR

[RFC PATCH v8 11/19] virtio/vsock: dequeue callback for SOCK_SEQPACKET

2021-04-13 Thread Arseny Krasnov
will send credit update for rest of record, and sender will wait for next enter of read syscall at receiver's side. So if user buffer is full, we just send credit update and drop data. Signed-off-by: Arseny Krasnov --- v7 -> v8: - Things like SEQ_BEGIN, SEQ_END, 'msg_len' and &

[RFC PATCH v8 12/19] virtio/vsock: add SEQPACKET receive logic

2021-04-13 Thread Arseny Krasnov
This modifies current receive logic for SEQPACKET support: 1) Inserts 'RW' packet to socket's rx queue, but without merging with buffer of last packet in queue. 2) Performs check for packet and socket types on receive(if mismatch, then reset connection). Signed-off-by:

[RFC PATCH v8 13/19] virtio/vsock: rest of SOCK_SEQPACKET support

2021-04-13 Thread Arseny Krasnov
This adds rest of logic for SEQPACKET: 1) Send SHUTDOWN on socket close for SEQPACKET type. 2) Set SEQPACKET packet type during send. 3) 'seqpacket_allow' flag to virtio transport. 4) Set 'VIRTIO_VSOCK_SEQ_EOR' bit in flags for last packet of message. Signed-off-by: Ar

  1   2   >