@@ -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);
@@ -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;
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(+)