summary refs log tree commit diff stats
path: root/hw/net/vhost_net.c
diff options
context:
space:
mode:
authorEugenio Pérez <eperezma@redhat.com>2022-08-23 20:30:35 +0200
committerJason Wang <jasowang@redhat.com>2022-09-02 10:22:39 +0800
commit539573c317dc0b8d50a128db60550f2f2898d2fc (patch)
tree4feb1d596fa4513ee1ea950bc4e8d753d8b7fedb /hw/net/vhost_net.c
parentbe4278b65fc1be8fce87e1e7c01bc52602d304eb (diff)
downloadfocaccia-qemu-539573c317dc0b8d50a128db60550f2f2898d2fc.tar.gz
focaccia-qemu-539573c317dc0b8d50a128db60550f2f2898d2fc.zip
vhost_net: add NetClientState->load() callback
It allows per-net client operations right after device's successful
start. In particular, to load the device status.

Vhost-vdpa net will use it to add the CVQ buffers to restore the device
status.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'hw/net/vhost_net.c')
-rw-r--r--hw/net/vhost_net.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 9d4b334453..d28f8b974b 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -281,6 +281,13 @@ static int vhost_net_start_one(struct vhost_net *net,
             }
         }
     }
+
+    if (net->nc->info->load) {
+        r = net->nc->info->load(net->nc);
+        if (r < 0) {
+            goto fail;
+        }
+    }
     return 0;
 fail:
     file.fd = -1;