[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: [RESEND Patch v1 22/37] vhost-pci-slave/msg: VHOST_USER_SET_VRING_ENABLE
Enable/Disable the corresponding virtqueue pairs in the list. Signed-off-by: Wei Wang <wei.w.wang@intel.com> --- 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
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]