[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RESEND Patch v1 22/37] vhost-pci-slave/msg: VHOST_USER_SET
From: |
Wei Wang |
Subject: |
[Qemu-devel] [RESEND Patch v1 22/37] vhost-pci-slave/msg: VHOST_USER_SET_VRING_ENABLE |
Date: |
Mon, 19 Dec 2016 13:58:57 +0800 |
Enable/Disable the corresponding virtqueue pairs in the list.
Signed-off-by: Wei Wang <address@hidden>
---
hw/virtio/vhost-pci-slave.c | 15 +++++++++++++++
include/hw/virtio/vhost-pci-slave.h | 1 +
2 files changed, 16 insertions(+)
diff --git a/hw/virtio/vhost-pci-slave.c b/hw/virtio/vhost-pci-slave.c
index 5bb1285..4b4d3c8 100644
--- a/hw/virtio/vhost-pci-slave.c
+++ b/hw/virtio/vhost-pci-slave.c
@@ -245,6 +245,18 @@ static void vp_slave_set_vring_call(int fd)
pvq_node->callfd = fd;
}
+static void vp_slave_set_vring_enable(VhostUserMsg *msg)
+{
+ struct vhost_vring_state *state = &msg->payload.state;
+ PeerVqNode *pvq_node;
+ QLIST_FOREACH(pvq_node, &vp_slave->pvq_list, node) {
+ if (pvq_node->vring_num == state->index) {
+ pvq_node->enabled = (int)state->num;
+ break;
+ }
+ }
+}
+
static int vp_slave_can_read(void *opaque)
{
return VHOST_USER_HDR_SIZE;
@@ -343,6 +355,9 @@ static void vp_slave_read(void *opaque, const uint8_t *buf,
int size)
*/
qemu_set_nonblock(fds[0]);
break;
+ case VHOST_USER_SET_VRING_ENABLE:
+ vp_slave_set_vring_enable(&msg);
+ break;
default:
error_report("vhost-pci-slave does not support msg request = %d",
msg.request);
diff --git a/include/hw/virtio/vhost-pci-slave.h
b/include/hw/virtio/vhost-pci-slave.h
index f6206a1..3e0f4c7 100644
--- a/include/hw/virtio/vhost-pci-slave.h
+++ b/include/hw/virtio/vhost-pci-slave.h
@@ -12,6 +12,7 @@ typedef struct PeerVqNode {
uint32_t vring_num;
int kickfd;
int callfd;
+ int enabled;
struct vhost_vring_addr addr;
QLIST_ENTRY(PeerVqNode) node;
} PeerVqNode;
--
2.7.4
- [Qemu-devel] [RESEND Patch v1 10/37] vhost-pci-slave/msg: VHOST_USER_SET_PROTOCOL_FEATURES, (continued)
- [Qemu-devel] [RESEND Patch v1 10/37] vhost-pci-slave/msg: VHOST_USER_SET_PROTOCOL_FEATURES, Wei Wang, 2016/12/19
- [Qemu-devel] [RESEND Patch v1 09/37] vhost-pci-slave/msg: VHOST_USER_GET_PROTOCOL_FEATURES, Wei Wang, 2016/12/19
- [Qemu-devel] [RESEND Patch v1 11/37] vhost-user/msg: VHOST_USER_PROTOCOL_F_SET_DEVICE_ID, Wei Wang, 2016/12/19
- [Qemu-devel] [RESEND Patch v1 12/37] vhost-pci-slave/msg: VHOST_USER_SET_DEVICE_ID, Wei Wang, 2016/12/19
- [Qemu-devel] [RESEND Patch v1 13/37] vhost-pci-slave/msg: VHOST_USER_GET_QUEUE_NUM, Wei Wang, 2016/12/19
- [Qemu-devel] [RESEND Patch v1 14/37] vhost-pci-slave/msg: VHOST_USER_SET_OWNER, Wei Wang, 2016/12/19
- [Qemu-devel] [RESEND Patch v1 15/37] vhost-pci-slave/msg: VHOST_USER_SET_MEM_TABLE, Wei Wang, 2016/12/19
- [Qemu-devel] [RESEND Patch v1 16/37] vhost-pci-slave/msg: VHOST_USER_SET_VRING_NUM, Wei Wang, 2016/12/19
- [Qemu-devel] [RESEND Patch v1 17/37] vhost-pci-slave/msg: VHOST_USER_SET_VRING_BASE, Wei Wang, 2016/12/19
- [Qemu-devel] [RESEND Patch v1 18/37] vhost-user: send guest physical address of virtqueues to the slave, Wei Wang, 2016/12/19
- [Qemu-devel] [RESEND Patch v1 22/37] vhost-pci-slave/msg: VHOST_USER_SET_VRING_ENABLE,
Wei Wang <=
- [Qemu-devel] [RESEND Patch v1 21/37] vhost-pci-slave/msg: VHOST_USER_SET_VRING_CALL, Wei Wang, 2016/12/19
- [Qemu-devel] [RESEND Patch v1 20/37] vhost-pci-slave/msg: VHOST_USER_SET_VRING_KICK, Wei Wang, 2016/12/19
- [Qemu-devel] [RESEND Patch v1 19/37] vhost-pci-slave/msg: VHOST_USER_SET_VRING_ADDR, Wei Wang, 2016/12/19
- [Qemu-devel] [RESEND Patch v1 23/37] vhost-pci-slave/msg: VHOST_USER_SET_LOG_BASE, Wei Wang, 2016/12/19
- [Qemu-devel] [RESEND Patch v1 24/37] vhost-pci-slave/msg: VHOST_USER_SET_LOG_FD, Wei Wang, 2016/12/19
- [Qemu-devel] [RESEND Patch v1 25/37] vhost-pci-slave/msg: VHOST_USER_SEND_RARP, Wei Wang, 2016/12/19
- [Qemu-devel] [RESEND Patch v1 26/37] vhost-pci-slave/msg: VHOST_USER_GET_VRING_BASE, Wei Wang, 2016/12/19
- [Qemu-devel] [RESEND Patch v1 28/37] vhost-pci-net: pass the mem and vring info to the driver, Wei Wang, 2016/12/19
- [Qemu-devel] [RESEND Patch v1 27/37] vhost-pci-net: pass the info collected by vp_slave to the device, Wei Wang, 2016/12/19
- [Qemu-devel] [RESEND Patch v1 29/37] vhost-pci-slave/msg: VHOST_USER_SET_VHOST_PCI (start), Wei Wang, 2016/12/19