[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v1 13/37] vhost-pci-slave/msg: VHOST_USER_GET_QUEUE_
From: |
Wei Wang |
Subject: |
[Qemu-devel] [PATCH v1 13/37] vhost-pci-slave/msg: VHOST_USER_GET_QUEUE_NUM |
Date: |
Sat, 17 Dec 2016 18:43:23 +0800 |
Send the max supported queue num according to the device type back to
the master.
Signed-off-by: Wei Wang <address@hidden>
---
hw/virtio/vhost-pci-slave.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/hw/virtio/vhost-pci-slave.c b/hw/virtio/vhost-pci-slave.c
index 9b00be4..8e5ecf8 100644
--- a/hw/virtio/vhost-pci-slave.c
+++ b/hw/virtio/vhost-pci-slave.c
@@ -90,6 +90,23 @@ static void vp_slave_set_device_type(VhostUserMsg *msg)
}
}
+static int vp_slave_get_queue_num(CharBackend *chr_be, VhostUserMsg *msg)
+{
+ switch (vp_slave->dev_type) {
+ case VIRTIO_ID_NET:
+ msg->payload.u64 = VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX;
+ break;
+ default:
+ error_report("GET_QUEUE_NUM: device type %d is not supported",
+ vp_slave->dev_type);
+ return -1;
+ }
+ msg->size = sizeof(msg->payload.u64);
+ msg->flags |= VHOST_USER_REPLY_MASK;
+
+ return vp_slave_write(chr_be, msg);
+}
+
static int vp_slave_can_read(void *opaque)
{
return VHOST_USER_HDR_SIZE;
@@ -141,6 +158,11 @@ static void vp_slave_read(void *opaque, const uint8_t
*buf, int size)
case VHOST_USER_SET_DEVICE_ID:
vp_slave_set_device_type(&msg);
break;
+ case VHOST_USER_GET_QUEUE_NUM:
+ ret = vp_slave_get_queue_num(chr_be, &msg);
+ if (ret < 0)
+ goto err_handling;
+ break;
default:
error_report("vhost-pci-slave does not support msg request = %d",
msg.request);
--
2.7.4
- [Qemu-devel] [PATCH v1 03/37] vhost-user: share the vhost-user protocol related structures, (continued)
- [Qemu-devel] [PATCH v1 03/37] vhost-user: share the vhost-user protocol related structures, Wei Wang, 2016/12/17
- [Qemu-devel] [PATCH v1 05/37] vhost-pci-slave: start the implementation of vhost-pci-slave, Wei Wang, 2016/12/17
- [Qemu-devel] [PATCH v1 06/37] vhost-pci-slave: set up the fundamental handlers for the server socket, Wei Wang, 2016/12/17
- [Qemu-devel] [PATCH v1 08/37] vhost-pci-slave/msg: VHOST_USER_SET_FEATURES, Wei Wang, 2016/12/17
- [Qemu-devel] [PATCH v1 07/37] vhost-pci-slave/msg: VHOST_USER_GET_FEATURES, Wei Wang, 2016/12/17
- [Qemu-devel] [PATCH v1 09/37] vhost-pci-slave/msg: VHOST_USER_GET_PROTOCOL_FEATURES, Wei Wang, 2016/12/17
- [Qemu-devel] [PATCH v1 10/37] vhost-pci-slave/msg: VHOST_USER_SET_PROTOCOL_FEATURES, Wei Wang, 2016/12/17
- [Qemu-devel] [PATCH v1 11/37] vhost-user/msg: VHOST_USER_PROTOCOL_F_SET_DEVICE_ID, Wei Wang, 2016/12/17
- [Qemu-devel] [PATCH v1 12/37] vhost-pci-slave/msg: VHOST_USER_SET_DEVICE_ID, Wei Wang, 2016/12/17
- [Qemu-devel] [PATCH v1 14/37] vhost-pci-slave/msg: VHOST_USER_SET_OWNER, Wei Wang, 2016/12/17
- [Qemu-devel] [PATCH v1 13/37] vhost-pci-slave/msg: VHOST_USER_GET_QUEUE_NUM,
Wei Wang <=
- [Qemu-devel] [PATCH v1 15/37] vhost-pci-slave/msg: VHOST_USER_SET_MEM_TABLE, Wei Wang, 2016/12/17
- [Qemu-devel] [PATCH v1 17/37] vhost-pci-slave/msg: VHOST_USER_SET_VRING_BASE, Wei Wang, 2016/12/17
- [Qemu-devel] [PATCH v1 16/37] vhost-pci-slave/msg: VHOST_USER_SET_VRING_NUM, Wei Wang, 2016/12/17
- [Qemu-devel] [PATCH v1 19/37] vhost-pci-slave/msg: VHOST_USER_SET_VRING_ADDR, Wei Wang, 2016/12/17
- [Qemu-devel] [PATCH v1 18/37] vhost-user: send guest physical address of virtqueues to the slave, Wei Wang, 2016/12/17
- [Qemu-devel] [PATCH v1 20/37] vhost-pci-slave/msg: VHOST_USER_SET_VRING_KICK, Wei Wang, 2016/12/17
- [Qemu-devel] [PATCH v1 21/37] vhost-pci-slave/msg: VHOST_USER_SET_VRING_CALL, Wei Wang, 2016/12/17
- [Qemu-devel] [PATCH v1 22/37] vhost-pci-slave/msg: VHOST_USER_SET_VRING_ENABLE, Wei Wang, 2016/12/17
- [Qemu-devel] [PATCH v1 24/37] vhost-pci-slave/msg: VHOST_USER_SET_LOG_FD, Wei Wang, 2016/12/17
- [Qemu-devel] [PATCH v1 23/37] vhost-pci-slave/msg: VHOST_USER_SET_LOG_BASE, Wei Wang, 2016/12/17