Linux virtualization list
 help / color / mirror / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: "Jiang Wang ." <jiang.wang@bytedance.com>
Cc: cong.wang@bytedance.com,
	Xiongchun Duan <duanxiongchun@bytedance.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	cohuck@redhat.com, virtualization@lists.linux-foundation.org,
	xieyongji@bytedance.com, Stefan Hajnoczi <stefanha@redhat.com>,
	asias@redhat.com, Arseny Krasnov <arseny.krasnov@kaspersky.com>
Subject: Re: [RFC v2] virtio-vsock: add description for datagram type
Date: Tue, 4 May 2021 18:16:51 +0200	[thread overview]
Message-ID: <20210504161651.3b6fhi64d7g3jui4@steredhat> (raw)
In-Reply-To: <CAP_N_Z9xPgyf=au4VD+fXF8iorZHHk7Q4-CbJCOVUeupG4v4sw@mail.gmail.com>

Hi Jiang,

On Mon, May 03, 2021 at 08:40:46PM -0700, Jiang Wang . wrote:
>Hi Stefano,
>
>I checked the VIRTIO_NET_F_MRG_RXBUF feature bit and I think vsock
>dgram can use that feature too.

Cool, thanks for checking!

>Do we want to make this feature a must-have or optional? One idea is
>to make it optional. When not

I think optional is fine, and we should support it for all kind of 
traffic (stream, dgram, seqpacket).

>supported, dgram rx buf is 16 KB which should be good in most cases.

Why not 4 KB like for stream? Or we could make it configurable.

>When VIRTIO_NET_F_MRG_RXBUF is supported, the rx buf is 4K and the max
>packet size is 64 KB.
>
>Also, just to make sure we are on the same page, the current vsock
>stream code can also split a
>big packet to multiple buffers and the receive side can assemble them
>together.

Yes, sort of. Being a stream, there's no concept of a boundary.

> But dgram cannot
>use that code because the dgram may drop a buffer in the driver code
>(if there is not enough space).
>That means dgram may drop some buffers at the beginning, in the end or in the
>middle of a pkt. And a packet may
>not be received as a complete one. Therefore, we need something like
>VIRTIO_NET_F_MRG_RXBUF.

Yep.

>
>If we want to leverage current stream code without using 
>VIRTIO_NET_F_MRG_RXBUF,
>we could add a total_len and offset to the virtio_vsock_hdr. Then when sending
>packet, the device split the big packet to multiple small ones and
>each has a header. They will have the
>same total_len, but different offsets. On the driver side, the driver
>can check the total_len before
>enqueueing the big packet for the one with offset 0.
>If there is enough space, all the remaining packets will be received.
>If not, the remaining packets will be dropped.
>I feel this implementation might be easier than using
>VIRTIO_NET_F_MRG_RXBUF. But either one is fine with me.
>Any preference? Thanks.

This is very similar to what we discussed with Michael. He pointed out 
that it could be complicated and we could have several problems.

For example, we should also provide an ID to prevent different fragments 
from overlapping. Also we might have problems handling different flows 
at the same time.

Mergable buffers allow us to avoid these problems and also bring 
advantages for the other types of traffic (stream, seqpacket).

It also allows us to use a single header for the packet and all its 
fragments.

So IMHO, if there are no significant issues, the best way would be to 
implement mergeable buffers in vsock,
I think there are only advantages to using this feature.

Thanks,
Stefano

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2021-05-04 16:17 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-01  4:36 [RFC v2] virtio-vsock: add description for datagram type jiang.wang
2021-04-12 13:50 ` Stefan Hajnoczi
2021-04-12 14:21   ` Stefano Garzarella
2021-04-12 22:42     ` Jiang Wang .
2021-04-13 12:58       ` Stefano Garzarella
2021-04-13 13:16         ` Michael S. Tsirkin
2021-04-13 13:38           ` Stefano Garzarella
2021-04-13 13:50             ` Michael S. Tsirkin
2021-04-13 14:03               ` Stefano Garzarella
2021-04-13 19:58                 ` Michael S. Tsirkin
2021-04-13 22:00                   ` Jiang Wang .
2021-04-14  7:07                     ` Stefano Garzarella
2021-04-14  6:57                   ` Stefano Garzarella
2021-04-14  7:20                     ` Michael S. Tsirkin
2021-04-14  9:38                       ` Stefano Garzarella
2021-04-15  3:15                         ` Jiang Wang .
2021-05-04  3:40                           ` Jiang Wang .
2021-05-04 16:16                             ` Stefano Garzarella [this message]
2021-05-04 17:06                               ` Jiang Wang .
2021-05-05 10:49                                 ` Stefano Garzarella
2021-05-05 16:58                                   ` Jiang Wang .
2021-05-07 16:53                                     ` Jiang Wang .
2021-05-10 14:50                                       ` Stefano Garzarella
2021-05-13 23:26                                         ` Jiang Wang .
2021-05-14 15:17                                           ` Stefano Garzarella
2021-05-14 18:55                                             ` Jiang Wang .
2021-05-17 11:02                                               ` Stefano Garzarella
2021-05-18  6:33                                                 ` Jiang Wang .
2021-05-18 13:02                                                   ` Stefano Garzarella
2021-05-19  4:59                                                     ` Jiang Wang .
2021-06-09  4:31                                                       ` Jiang Wang .
2021-06-09  7:40                                                         ` Stefano Garzarella
2021-04-12 22:39   ` [External] " Jiang Wang .
2021-05-13 14:57     ` Stefan Hajnoczi

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=20210504161651.3b6fhi64d7g3jui4@steredhat \
    --to=sgarzare@redhat.com \
    --cc=arseny.krasnov@kaspersky.com \
    --cc=asias@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=cong.wang@bytedance.com \
    --cc=duanxiongchun@bytedance.com \
    --cc=jiang.wang@bytedance.com \
    --cc=mst@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xieyongji@bytedance.com \
    /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