Skip to contentSkip to conversation

vhost: let SET_VRING_ENABLE message depends on protocol feature

PATCH New Yuanhan Liu 1 participant 2 messages Nov 13, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 vhost: let SET_VRING_ENABLE message depends on protocol feature

But not depend on PROTOCOL_F_MQ feature bit. So that we could use SET_VRING_ENABLE to sign the backend on stop, even if MQ is disabled.

That's reasonable, since we will have one queue pair at least.

---
 hw/virtio/vhost-user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/vhost-user.c +1 -1
index 4766f98..a9c8335 100644
@@ -331,7 +331,7 @@ static int vhost_user_set_vring_enable(struct vhost_dev *dev, int enable)
         .num   = enable,
     };
 
-    if (!(dev->protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_MQ))) {
+    if (!virtio_has_feature(dev->features, VHOST_USER_F_PROTOCOL_FEATURES)) {
         return -1;
     }
 
Signature · 1 line
1.9.3
#1 lore raw

PATCH 2/2 vhost: don't send RESET_OWNER at stop

First of all, RESET_OWNER message is sent incorrectly, as it's sent before GET_VRING_BASE. And the reset message would let the later call get nothing correct.

And, sending SET_VRING_ENABLE at stop, which has already been done, makes more sense than RESET_OWNER.

---
 hw/net/vhost_net.c | 6 ------
 1 file changed, 6 deletions(-)
hw/net/vhost_net.c +0 -6
index d91b7b1..14337a4 100644
@@ -292,12 +292,6 @@ static void vhost_net_stop_one(struct vhost_net *net,
             int r = vhost_ops->vhost_net_set_backend(&net->dev, &file);
             assert(r >= 0);
         }
-    } else if (net->nc->info->type == NET_CLIENT_OPTIONS_KIND_VHOST_USER) {
-        for (file.index = 0; file.index < net->dev.nvqs; ++file.index) {
-            const VhostOps *vhost_ops = net->dev.vhost_ops;
-            int r = vhost_ops->vhost_reset_device(&net->dev);
-            assert(r >= 0);
-        }
     }
     if (net->nc->info->poll) {
         net->nc->info->poll(net->nc, true);
Signature · 1 line
1.9.3