All of lore.kernel.org
 help / color / mirror / Atom feed
From: jiangyiwen <jiangyiwen@huawei.com>
To: stefanha@redhat.com, stefanha@gmail.com,
	Jason Wang <jasowang@redhat.com>,
	mst@redhat.com
Cc: netdev@vger.kernel.org, kvm@vger.kernel.org,
	virtualization@lists.linux-foundation.org
Subject: [RFC] Discuss about an new idea "Vsock over Virtio-net"
Date: Thu, 15 Nov 2018 11:56:03 +0800	[thread overview]
Message-ID: <5BECEE53.7090408@huawei.com> (raw)

Hi Stefan, Michael, Jason and everyone,

Several days ago, I discussed with jason about "Vsock over Virtio-net".
This idea has two advantages:
First, it can use many great features of virtio-net, like batching,
mergeable rx buffer and multiqueue, etc.
Second, it can reduce many duplicate codes and make it easy to be
maintained.

Before the implement, I want to discuss with everyone again, and
want to know everyone's suggestions.

After the discussion, based on this point I will try to implement
this idea, but I am not familiar with the virtio-net, that is a
pity. :(

-------------------------Simple idea------------------------------

1. The packet layout will become as follows:

+---------------------------------+
|        Virtio-net header        |
|(struct virtio_net_hdr_mrg_rxbuf)|
+---------------------------------+
|          Vsock header           |
|    (struct virtio_vsock_hdr)    |
+---------------------------------+
|             payload             |
|      (until end of packet)      |
+---------------------------------+

2. The Guest->Host basic code flow as follow:
                            +------------+
                            |   Client   |
                            +------------+
                                  |
                                  |
+------------------------------------------------------------------+
|VSOCK Core Module                                                 |
|ops->sendmsg; (vsock_stream_sendmsg)                              |
|  -> alloc_skb; /* it will packet a skb buffer, and include vsock |
|                 * hdr and payload */                             |
|  -> dev_queue_xmit(); /* it will call start_xmit(virtio-net.c) */|
|vsock hdr and payload, and then call                              |
+------------------------------------------------------------------+
                                  |
                                  |
+------------------------------------------------------------------+
|Virtio-net Module                                                 |
|start_xmit                                                        |
|  -> add virtio_net_hdr and pack sg in ring desc, notify Host     |
+------------------------------------------------------------------+
                                  |
                                  |
+------------------------------------------------------------------+
|Vhost-net Module                                                  |
|handle_tx                                                         |
|  -> get tx buffer, skip virtio_net_hdr and call Vsock function.  |
| /* This point has some differences, vhost-net use ->sendmsg to   |
|  * forward information, however vsock only need to notify server |
|  * that data ready. */                                           |
+------------------------------------------------------------------+
                                  |
                                  |
+------------------------------------------------------------------+
|VSOCK Core Module                                                 |
|alloc_pkt, copy skb data to pkt.                                  |
|add pkt to rx_queue and notify server to get data.                |
+------------------------------------------------------------------+

3. To Host->Guest
I have a problem and difficult, mainly I know about virtio-net a little),
because I have been doing work related with storage and file system.

The problem as follows:
we should monitor all of socket of vsock in handle_rx, when there are
data coming, and copy data to vq desc. Vhost-net use ->recvmsg to
get data, it is different with socket. To vsock, I think host will
not call ->recvmsg when it need to send message to guest. To net,
vhost-net only as forwarding layer.

WARNING: multiple messages have this Message-ID (diff)
From: jiangyiwen <jiangyiwen@huawei.com>
To: <stefanha@redhat.com>, <stefanha@gmail.com>,
	Jason Wang <jasowang@redhat.com>, <mst@redhat.com>
Cc: netdev@vger.kernel.org, kvm@vger.kernel.org,
	virtualization@lists.linux-foundation.org
Subject: [RFC] Discuss about an new idea "Vsock over Virtio-net"
Date: Thu, 15 Nov 2018 11:56:03 +0800	[thread overview]
Message-ID: <5BECEE53.7090408@huawei.com> (raw)

Hi Stefan, Michael, Jason and everyone,

Several days ago, I discussed with jason about "Vsock over Virtio-net".
This idea has two advantages:
First, it can use many great features of virtio-net, like batching,
mergeable rx buffer and multiqueue, etc.
Second, it can reduce many duplicate codes and make it easy to be
maintained.

Before the implement, I want to discuss with everyone again, and
want to know everyone's suggestions.

After the discussion, based on this point I will try to implement
this idea, but I am not familiar with the virtio-net, that is a
pity. :(

-------------------------Simple idea------------------------------

1. The packet layout will become as follows:

+---------------------------------+
|        Virtio-net header        |
|(struct virtio_net_hdr_mrg_rxbuf)|
+---------------------------------+
|          Vsock header           |
|    (struct virtio_vsock_hdr)    |
+---------------------------------+
|             payload             |
|      (until end of packet)      |
+---------------------------------+

2. The Guest->Host basic code flow as follow:
                            +------------+
                            |   Client   |
                            +------------+
                                  |
                                  |
+------------------------------------------------------------------+
|VSOCK Core Module                                                 |
|ops->sendmsg; (vsock_stream_sendmsg)                              |
|  -> alloc_skb; /* it will packet a skb buffer, and include vsock |
|                 * hdr and payload */                             |
|  -> dev_queue_xmit(); /* it will call start_xmit(virtio-net.c) */|
|vsock hdr and payload, and then call                              |
+------------------------------------------------------------------+
                                  |
                                  |
+------------------------------------------------------------------+
|Virtio-net Module                                                 |
|start_xmit                                                        |
|  -> add virtio_net_hdr and pack sg in ring desc, notify Host     |
+------------------------------------------------------------------+
                                  |
                                  |
+------------------------------------------------------------------+
|Vhost-net Module                                                  |
|handle_tx                                                         |
|  -> get tx buffer, skip virtio_net_hdr and call Vsock function.  |
| /* This point has some differences, vhost-net use ->sendmsg to   |
|  * forward information, however vsock only need to notify server |
|  * that data ready. */                                           |
+------------------------------------------------------------------+
                                  |
                                  |
+------------------------------------------------------------------+
|VSOCK Core Module                                                 |
|alloc_pkt, copy skb data to pkt.                                  |
|add pkt to rx_queue and notify server to get data.                |
+------------------------------------------------------------------+

3. To Host->Guest
I have a problem and difficult, mainly I know about virtio-net a little),
because I have been doing work related with storage and file system.

The problem as follows:
we should monitor all of socket of vsock in handle_rx, when there are
data coming, and copy data to vq desc. Vhost-net use ->recvmsg to
get data, it is different with socket. To vsock, I think host will
not call ->recvmsg when it need to send message to guest. To net,
vhost-net only as forwarding layer.

             reply	other threads:[~2018-11-15  3:56 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-15  3:56 jiangyiwen [this message]
2018-11-15  3:56 ` [RFC] Discuss about an new idea "Vsock over Virtio-net" jiangyiwen
2018-11-15  4:19 ` Jason Wang
2018-11-15  6:46   ` jiangyiwen
2018-11-15  6:46     ` jiangyiwen
2018-11-15  6:49     ` jiangyiwen
2018-11-15  6:49       ` jiangyiwen
2018-11-15  8:19     ` Jason Wang
2018-11-15  9:02       ` jiangyiwen
2018-11-15  9:21         ` Jason Wang
2018-11-16  2:32           ` jiangyiwen
2018-11-16  2:32             ` jiangyiwen
2018-11-16  6:35             ` Jason Wang
2018-11-16  6:35             ` Jason Wang
2018-11-15  9:21         ` Jason Wang
2018-11-15  9:02       ` jiangyiwen
2018-11-15  4:19 ` Jason Wang
2018-11-15  7:04 ` Michael S. Tsirkin
2018-11-15  7:04 ` Michael S. Tsirkin
2018-11-15  7:38   ` jiangyiwen
2018-11-15  8:10     ` Michael S. Tsirkin
2018-11-15  8:27       ` Jason Wang
2018-11-15  8:27       ` Jason Wang
2018-11-15  8:38       ` jiangyiwen
2018-11-15  8:24   ` Jason Wang
2018-11-29 14:00     ` Michael S. Tsirkin
2018-11-30 12:45       ` Jason Wang
2018-11-30 12:52         ` Michael S. Tsirkin
2018-11-30 12:55           ` Jason Wang
2018-11-30 13:10             ` Jason Wang
2018-11-30 13:40               ` Michael S. Tsirkin
2018-11-30 13:40               ` Michael S. Tsirkin
2018-12-03  3:10                 ` jiangyiwen
2018-12-03  3:10                 ` jiangyiwen
2018-12-04  1:31                   ` Michael S. Tsirkin
2018-12-04  1:31                   ` Michael S. Tsirkin
2018-12-04  2:21                     ` jiangyiwen
2018-12-04  2:21                     ` jiangyiwen
2018-12-04  4:08                       ` Michael S. Tsirkin
2018-12-04  6:01                         ` jiangyiwen
2018-12-04  4:08                       ` Michael S. Tsirkin
2018-11-30 13:10             ` Jason Wang
2018-11-30 13:34             ` Michael S. Tsirkin
2018-11-30 13:34             ` Michael S. Tsirkin
2018-11-30 12:55           ` Jason Wang
2018-11-30 12:52         ` Michael S. Tsirkin
2018-11-30 12:45       ` Jason Wang
2018-11-29 14:00     ` Michael S. Tsirkin
2018-11-15  9:36 ` Yan Vugenfirer
2018-11-16  2:37   ` jiangyiwen
2018-11-16  2:37   ` jiangyiwen
2018-11-15  9:36 ` Yan Vugenfirer

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=5BECEE53.7090408@huawei.com \
    --to=jiangyiwen@huawei.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=stefanha@gmail.com \
    --cc=stefanha@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.