Message ID | 20210609232501.171257-6-jiang.wang@bytedance.com (mailing list archive) |
---|---|
State | RFC |
Headers | show |
Series | virtio/vsock: introduce SOCK_DGRAM support | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Guessed tree name to be net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 7 of 7 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 4 this patch: 4 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | warning | WARNING: please write a paragraph that describes the config symbol fully |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 4 this patch: 4 |
netdev/header_inline | success | Link |
On Wed, Jun 09, 2021 at 11:24:57PM +0000, Jiang Wang wrote: >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(-) As we already discussed, I think we don't need this patch. Thanks, Stefano
On Fri, Jun 18, 2021 at 2:54 AM Stefano Garzarella <sgarzare@redhat.com> wrote: > > On Wed, Jun 09, 2021 at 11:24:57PM +0000, Jiang Wang wrote: > >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(-) > > As we already discussed, I think we don't need this patch. Sure. will do > Thanks, > Stefano >
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);
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(-)