From: Jiang Wang <jiang.wang@bytedance.com>
To: sgarzare@redhat.com
Cc: virtualization@lists.linux-foundation.org, stefanha@redhat.com,
mst@redhat.com, arseny.krasnov@kaspersky.com,
jhansen@vmware.comments, cong.wang@bytedance.com,
duanxiongchun@bytedance.com, xieyongji@bytedance.com,
chaiwen.cc@bytedance.com, Jason Wang <jasowang@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@redhat.com>,
Andra Paraschiv <andraprs@amazon.com>,
Norbert Slusarek <nslusarek@gmx.net>,
Colin Ian King <colin.king@canonical.com>,
Lu Wei <luwei32@huawei.com>,
Alexander Popov <alex.popov@linux.com>,
kvm@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [RFC v1 5/6] vhost/vsock: add kconfig for vhost dgram support
Date: Wed, 9 Jun 2021 23:24:57 +0000 [thread overview]
Message-ID: <20210609232501.171257-6-jiang.wang@bytedance.com> (raw)
In-Reply-To: <20210609232501.171257-1-jiang.wang@bytedance.com>
Also change number of vqs according to the config
Signed-off-by: Jiang Wang <jiang.wang@bytedance.com>
---
drivers/vhost/Kconfig | 8 ++++++++
drivers/vhost/vsock.c | 11 ++++++++---
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig
index 587fbae06182..d63fffee6007 100644
--- a/drivers/vhost/Kconfig
+++ b/drivers/vhost/Kconfig
@@ -61,6 +61,14 @@ config VHOST_VSOCK
To compile this driver as a module, choose M here: the module will be called
vhost_vsock.
+config VHOST_VSOCK_DGRAM
+ bool "vhost vsock datagram sockets support"
+ depends on VHOST_VSOCK
+ default n
+ help
+ Enable vhost-vsock to support datagram types vsock. The QEMU
+ and the guest must support datagram types too to use it.
+
config VHOST_VDPA
tristate "Vhost driver for vDPA-based backend"
depends on EVENTFD
diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
index d366463be6d4..12ca1dc0268f 100644
--- a/drivers/vhost/vsock.c
+++ b/drivers/vhost/vsock.c
@@ -48,7 +48,11 @@ static DEFINE_READ_MOSTLY_HASHTABLE(vhost_vsock_hash, 8);
struct vhost_vsock {
struct vhost_dev dev;
+#ifdef CONFIG_VHOST_VSOCK_DGRAM
struct vhost_virtqueue vqs[4];
+#else
+ struct vhost_virtqueue vqs[2];
+#endif
/* Link to global vhost_vsock_hash, writes use vhost_vsock_mutex */
struct hlist_node hash;
@@ -763,15 +767,16 @@ static int vhost_vsock_dev_open(struct inode *inode, struct file *file)
vqs[VSOCK_VQ_TX] = &vsock->vqs[VSOCK_VQ_TX];
vqs[VSOCK_VQ_RX] = &vsock->vqs[VSOCK_VQ_RX];
- vqs[VSOCK_VQ_DGRAM_TX] = &vsock->vqs[VSOCK_VQ_DGRAM_TX];
- vqs[VSOCK_VQ_DGRAM_RX] = &vsock->vqs[VSOCK_VQ_DGRAM_RX];
vsock->vqs[VSOCK_VQ_TX].handle_kick = vhost_vsock_handle_tx_kick;
vsock->vqs[VSOCK_VQ_RX].handle_kick = vhost_vsock_handle_rx_kick;
+#ifdef CONFIG_VHOST_VSOCK_DGRAM
+ vqs[VSOCK_VQ_DGRAM_TX] = &vsock->vqs[VSOCK_VQ_DGRAM_TX];
+ vqs[VSOCK_VQ_DGRAM_RX] = &vsock->vqs[VSOCK_VQ_DGRAM_RX];
vsock->vqs[VSOCK_VQ_DGRAM_TX].handle_kick =
vhost_vsock_handle_tx_kick;
vsock->vqs[VSOCK_VQ_DGRAM_RX].handle_kick =
vhost_vsock_handle_rx_kick;
-
+#endif
vhost_dev_init(&vsock->dev, vqs, ARRAY_SIZE(vsock->vqs),
UIO_MAXIOV, VHOST_VSOCK_PKT_WEIGHT,
VHOST_VSOCK_WEIGHT, true, NULL);
--
2.11.0
next prev parent reply other threads:[~2021-06-09 23:28 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-09 23:24 [RFC v1 0/6] virtio/vsock: introduce SOCK_DGRAM support Jiang Wang
2021-06-09 23:24 ` [RFC v1 1/6] virtio/vsock: add VIRTIO_VSOCK_F_DGRAM feature bit Jiang Wang
2021-06-18 9:39 ` Stefano Garzarella
2021-06-21 17:24 ` [External] " Jiang Wang .
2021-06-22 10:50 ` Stefano Garzarella
2021-06-09 23:24 ` [RFC v1 2/6] virtio/vsock: add support for virtio datagram Jiang Wang
2021-06-18 9:52 ` Stefano Garzarella
2021-06-18 10:11 ` Stefano Garzarella
2021-06-09 23:24 ` [RFC v1 3/6] vhost/vsock: add support for vhost dgram Jiang Wang
2021-06-18 10:13 ` Stefano Garzarella
2021-06-21 17:32 ` [External] " Jiang Wang .
2021-06-09 23:24 ` [RFC v1 4/6] vsock_test: add tests for vsock dgram Jiang Wang
2021-06-09 23:24 ` Jiang Wang [this message]
2021-06-18 9:54 ` [RFC v1 5/6] vhost/vsock: add kconfig for vhost dgram support Stefano Garzarella
2021-06-21 17:25 ` [External] " Jiang Wang .
2021-06-09 23:24 ` [RFC v1 6/6] virtio/vsock: add sysfs for rx buf len for dgram Jiang Wang
2021-06-18 10:04 ` Stefano Garzarella
2021-06-21 17:27 ` [External] " Jiang Wang .
2021-06-10 1:50 ` [RFC v1 0/6] virtio/vsock: introduce SOCK_DGRAM support Jason Wang
2021-06-10 3:43 ` Jiang Wang .
2021-06-10 4:02 ` Jason Wang
2021-06-10 7:23 ` Stefano Garzarella
2021-06-10 7:46 ` Jason Wang
2021-06-10 9:51 ` Stefano Garzarella
2021-06-10 16:44 ` Jiang Wang .
2021-06-18 9:35 ` Stefano Garzarella
2021-06-21 17:21 ` [External] " Jiang Wang .
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=20210609232501.171257-6-jiang.wang@bytedance.com \
--to=jiang.wang@bytedance.com \
--cc=alex.popov@linux.com \
--cc=andraprs@amazon.com \
--cc=arseny.krasnov@kaspersky.com \
--cc=chaiwen.cc@bytedance.com \
--cc=colin.king@canonical.com \
--cc=cong.wang@bytedance.com \
--cc=davem@davemloft.net \
--cc=duanxiongchun@bytedance.com \
--cc=jasowang@redhat.com \
--cc=jhansen@vmware.comments \
--cc=kuba@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luwei32@huawei.com \
--cc=mingo@redhat.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nslusarek@gmx.net \
--cc=rostedt@goodmis.org \
--cc=sgarzare@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;
as well as URLs for NNTP newsgroup(s).