From b213af9aa4804ceb628cff7a248a8025068915cb Mon Sep 17 00:00:00 2001 From: Matan Azrad Date: Mon, 29 Jun 2020 14:08:20 +0000 Subject: [PATCH] vhost: notify virtq file descriptor update When virtq call or kick file descriptors are changed in the device configuration when the queue is ready, the application and the vDPA driver should be notified to be aligned to the new file descriptors. Notify the state to be disabled before the file descriptor update and return it back to be enabled after the update. Signed-off-by: Matan Azrad Reviewed-by: Maxime Coquelin Reviewed-by: Chenbo Xia --- lib/librte_vhost/vhost_user.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index d9c421bc01..6039a8fdb9 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -1619,6 +1619,12 @@ vhost_user_set_vring_call(struct virtio_net **pdev, struct VhostUserMsg *msg, "vring call idx:%d file:%d\n", file.index, file.fd); vq = dev->virtqueue[file.index]; + + if (vq->ready) { + vhost_user_notify_queue_state(dev, file.index, 0); + vq->ready = 0; + } + if (vq->callfd >= 0) close(vq->callfd); @@ -1877,6 +1883,11 @@ vhost_user_set_vring_kick(struct virtio_net **pdev, struct VhostUserMsg *msg, dev->vid, file.index, 1); } + if (vq->ready) { + vhost_user_notify_queue_state(dev, file.index, 0); + vq->ready = 0; + } + if (vq->kickfd >= 0) close(vq->kickfd); vq->kickfd = file.fd; -- 2.20.1