在 2023/7/21 02:14, Eugenio Pérez 写道:
Actually use vhost_restart_queue operation at restart.
Signed-off-by: Eugenio Pérez <epere...@redhat.com>
---
hw/net/vhost_net.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 6b958d6363..416b7d8132 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -608,14 +608,16 @@ int vhost_net_virtqueue_restart(VirtIODevice *vdev,
NetClientState *nc,
goto err_start;
}
- if (net->nc->info->type == NET_CLIENT_DRIVER_TAP) {
+ if (vhost_ops->vhost_restart_queue) {
+ r = vhost_ops->vhost_restart_queue(&net->dev, idx);
+ } else if (net->nc->info->type == NET_CLIENT_DRIVER_TAP) {
file.index = idx;
file.fd = net->backend;
r = vhost_net_set_backend(&net->dev, &file);
I would introduce a vhost-net specific reset routine and move the above
logic there.
Thanks
- if (r < 0) {
- r = -errno;
- goto err_start;
- }
+ }
+ if (r < 0) {
+ r = -errno;
+ goto err_start;
}
return 0;