|
@@ -531,3 +531,28 @@ int vhost_net_set_mtu(struct vhost_net *net, uint16_t mtu)
|
|
|
|
|
|
return vhost_ops->vhost_net_set_mtu(&net->dev, mtu);
|
|
|
}
|
|
|
+
|
|
|
+void vhost_net_virtqueue_reset(VirtIODevice *vdev, NetClientState *nc,
|
|
|
+ int vq_index)
|
|
|
+{
|
|
|
+ VHostNetState *net = get_vhost_net(nc->peer);
|
|
|
+ const VhostOps *vhost_ops = net->dev.vhost_ops;
|
|
|
+ struct vhost_vring_file file = { .fd = -1 };
|
|
|
+ int idx;
|
|
|
+
|
|
|
+ /* should only be called after backend is connected */
|
|
|
+ assert(vhost_ops);
|
|
|
+
|
|
|
+ idx = vhost_ops->vhost_get_vq_index(&net->dev, vq_index);
|
|
|
+
|
|
|
+ if (net->nc->info->type == NET_CLIENT_DRIVER_TAP) {
|
|
|
+ file.index = idx;
|
|
|
+ int r = vhost_net_set_backend(&net->dev, &file);
|
|
|
+ assert(r >= 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ vhost_virtqueue_stop(&net->dev,
|
|
|
+ vdev,
|
|
|
+ net->dev.vqs + idx,
|
|
|
+ net->dev.vq_index + idx);
|
|
|
+}
|