kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: Arseny Krasnov <arseny.krasnov@kaspersky.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Jorgen Hansen <jhansen@vmware.com>,
	Colin Ian King <colin.king@canonical.com>,
	Norbert Slusarek <nslusarek@gmx.net>,
	Andra Paraschiv <andraprs@amazon.com>,
	kvm@vger.kernel.org, virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	stsp2@yandex.ru, oxffffaa@gmail.com
Subject: Re: [RFC PATCH v6 11/22] virtio/vsock: dequeue callback for SOCK_SEQPACKET
Date: Mon, 15 Mar 2021 12:02:09 +0100	[thread overview]
Message-ID: <20210315110209.xuaq5q3a2zp4u3g5@steredhat> (raw)
In-Reply-To: <20210307180204.3465806-1-arseny.krasnov@kaspersky.com>

On Sun, Mar 07, 2021 at 09:02:01PM +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 copied(if user's buffer is full, user is not woken up). This is done
>to not stall sender, because if we wake up user and it leaves syscall,
>nobody 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. If during copy SEQ_BEGIN
>was found(and not all data was copied), copying is restarted by reset
>user's iov iterator(previous unfinished data is dropped).
>
>Signed-off-by: Arseny Krasnov <arseny.krasnov@kaspersky.com>
>---
> include/linux/virtio_vsock.h            |  13 +++
> include/uapi/linux/virtio_vsock.h       |  16 ++++
> net/vmw_vsock/virtio_transport_common.c | 116 ++++++++++++++++++++++++
> 3 files changed, 145 insertions(+)
>
>diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h
>index dc636b727179..466a5832d2f5 100644
>--- a/include/linux/virtio_vsock.h
>+++ b/include/linux/virtio_vsock.h
>@@ -18,6 +18,12 @@ enum {
> 	VSOCK_VQ_MAX    = 3,
> };
>
>+struct virtio_vsock_seqpack_state {
>+	u32 user_read_seq_len;
>+	u32 user_read_copied;
>+	u32 curr_rx_msg_id;
>+};
>+
> /* Per-socket state (accessed via vsk->trans) */
> struct virtio_vsock_sock {
> 	struct vsock_sock *vsk;
>@@ -36,6 +42,8 @@ struct virtio_vsock_sock {
> 	u32 rx_bytes;
> 	u32 buf_alloc;
> 	struct list_head rx_queue;
>+
>+	struct virtio_vsock_seqpack_state seqpacket_state;

Following 'virtio_vsock_seq_hdr', maybe we can shorten in:

         struct virtio_vsock_seq_state seq_state;

The rest LGTM.


  reply	other threads:[~2021-03-15 11:03 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-07 17:57 [RFC PATCH v6 00/22] virtio/vsock: introduce SOCK_SEQPACKET support Arseny Krasnov
2021-03-07 17:58 ` [RFC PATCH v6 01/22] af_vsock: update functions for connectible socket Arseny Krasnov
2021-03-12 14:38   ` Stefano Garzarella
2021-03-07 17:59 ` [RFC PATCH v6 02/22] af_vsock: separate wait data loop Arseny Krasnov
2021-03-12 14:40   ` Stefano Garzarella
2021-03-07 17:59 ` [RFC PATCH v6 03/22] af_vsock: separate receive " Arseny Krasnov
2021-03-07 17:59 ` [RFC PATCH v6 04/22] af_vsock: implement SEQPACKET receive loop Arseny Krasnov
2021-03-12 15:01   ` Stefano Garzarella
2021-03-12 15:17   ` Stefano Garzarella
2021-03-15  7:49     ` Arseny Krasnov
2021-03-07 17:59 ` [RFC PATCH v6 05/22] af_vsock: separate wait space loop Arseny Krasnov
2021-03-07 18:00 ` [RFC PATCH v6 06/22] af_vsock: implement send logic for SEQPACKET Arseny Krasnov
2021-03-12 15:10   ` Stefano Garzarella
2021-03-15  7:49     ` Arseny Krasnov
2021-03-07 18:00 ` [RFC PATCH v6 07/22] af_vsock: rest of SEQPACKET support Arseny Krasnov
2021-03-12 15:28   ` Stefano Garzarella
2021-03-07 18:01 ` [RFC PATCH v6 08/22] af_vsock: update comments for stream sockets Arseny Krasnov
2021-03-12 15:29   ` Stefano Garzarella
2021-03-07 18:01 ` [RFC PATCH v6 09/22] virtio/vsock: set packet's type in virtio_transport_send_pkt_info() Arseny Krasnov
2021-03-12 15:31   ` Stefano Garzarella
2021-03-07 18:01 ` [RFC PATCH v6 10/22] virtio/vsock: simplify credit update function API Arseny Krasnov
2021-03-12 15:33   ` Stefano Garzarella
2021-03-07 18:02 ` [RFC PATCH v6 11/22] virtio/vsock: dequeue callback for SOCK_SEQPACKET Arseny Krasnov
2021-03-15 11:02   ` Stefano Garzarella [this message]
2021-03-07 18:02 ` [RFC PATCH v6 12/22] virtio/vsock: fetch length for SEQPACKET record Arseny Krasnov
2021-03-12 15:20   ` Stefano Garzarella
2021-03-15  7:49     ` Arseny Krasnov
2021-03-07 18:02 ` [RFC PATCH v6 13/22] virtio/vsock: add SEQPACKET receive logic Arseny Krasnov
2021-03-15 11:15   ` Stefano Garzarella
2021-03-07 18:03 ` [RFC PATCH v6 14/22] virtio/vsock: rest of SOCK_SEQPACKET support Arseny Krasnov
2021-03-15 11:25   ` Stefano Garzarella
2021-03-07 18:03 ` [RFC PATCH v6 15/22] virtio/vsock: SEQPACKET support feature bit Arseny Krasnov
2021-03-07 18:03 ` [RFC PATCH v6 16/22] vhost/vsock: SEQPACKET feature bit support Arseny Krasnov
2021-03-15 11:28   ` Stefano Garzarella
2021-03-07 18:04 ` [RFC PATCH v6 17/22] virtio/vsock: " Arseny Krasnov
2021-03-15 11:29   ` Stefano Garzarella
2021-03-07 18:04 ` [RFC PATCH v6 18/22] virtio/vsock: setup SEQPACKET ops for transport Arseny Krasnov
2021-03-07 18:04 ` [RFC PATCH v6 19/22] vhost/vsock: " Arseny Krasnov
2021-03-07 18:04 ` [RFC PATCH v6 20/22] vsock/loopback: " Arseny Krasnov
2021-03-07 18:05 ` [RFC PATCH v6 21/22] vsock_test: add SOCK_SEQPACKET tests Arseny Krasnov
2021-03-07 18:05 ` [RFC PATCH v6 22/22] virtio/vsock: update trace event for SEQPACKET Arseny Krasnov
2021-03-10 10:06 ` [RFC PATCH v6 00/22] virtio/vsock: introduce SOCK_SEQPACKET support Stefano Garzarella
2021-03-10 10:13   ` Arseny Krasnov
2021-03-15 11:40 ` Stefano Garzarella
2021-03-15 15:22   ` Arseny Krasnov
2021-03-16  3:37     ` Arseny Krasnov
2021-03-16  8:08       ` Stefano Garzarella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210315110209.xuaq5q3a2zp4u3g5@steredhat \
    --to=sgarzare@redhat.com \
    --cc=andraprs@amazon.com \
    --cc=arseny.krasnov@kaspersky.com \
    --cc=colin.king@canonical.com \
    --cc=davem@davemloft.net \
    --cc=jasowang@redhat.com \
    --cc=jhansen@vmware.com \
    --cc=kuba@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=nslusarek@gmx.net \
    --cc=oxffffaa@gmail.com \
    --cc=stefanha@redhat.com \
    --cc=stsp2@yandex.ru \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).