Skip to contentSkip to conversation

vhost-user: save features if the char dev is closed

PATCH In review Adrian Moreno 2 participants 2 messages Sep 24, 2019 – Sep 25, 2019 Networking

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 vhost-user: save features if the char dev is closed

That way the state can be correctly restored when the device is opened again. This might happen if the backend is restarted.

Fixes 6ab79a20af3a (do not call vhost_net_cleanup() on running net from char user event)
Cc Michael S. Tsirkin <[email protected]>
---
 net/vhost-user.c | 4 ++++
 1 file changed, 4 insertions(+)
net/vhost-user.c +4 -0
index 51921de443..014199d600 100644
@@ -235,6 +235,10 @@ static void chr_closed_bh(void *opaque)
 
     s = DO_UPCAST(NetVhostUserState, nc, ncs[0]);
 
+    if (s->vhost_net) {
+        s->acked_features = vhost_net_get_acked_features(s->vhost_net);
+    }
+
     qmp_set_link(name, false, &err);
 
     qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, net_vhost_user_event,
Signature · 1 line
2.21.0
Acked-by on v3 1/1
#1 lore raw
Quoted 19 lines · Adrian Moreno

That way the state can be correctly restored when the device is opened again. This might happen if the backend is restarted.

Fixes 6ab79a20af3a (do not call vhost_net_cleanup() on running net from char user event)
Cc Michael S. Tsirkin <[email protected]>
---
 net/vhost-user.c | 4 ++++
 1 file changed, 4 insertions(+)
net/vhost-user.c +0 -0
index 51921de443..014199d600 100644

net/vhost-user.c static void chr_closed_bh(void *opaque) · line 244

Quoted 10 lines
net/vhost-user.c +4 -0
@@ -235,6 +235,10 @@ static void chr_closed_bh(void *opaque)
 
     s = DO_UPCAST(NetVhostUserState, nc, ncs[0]);
 
+    if (s->vhost_net) {
+        s->acked_features = vhost_net_get_acked_features(s->vhost_net);
+    }
+
     qmp_set_link(name, false, &err);
 
     qemu_chr_fe_set_handlers(&s->chr, NULL, NULL, net_vhost_user_event,