mirror of https://github.com/xqemu/xqemu.git
vhost-net: save & restore vring enable state
A driver may change the vring enable state at run time but vhost-user backend may not be present (a contrived example is when the backend is disconnected and the device is reconfigured after driver rebinding) Restore the vring state when the vhost-user backend is started, so it can process the ring. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Tested-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> Reviewed-by: Victor Kaplansky <victork@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
a463215b08
commit
bfc6cf31ce
|
@ -329,6 +329,15 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
goto err_start;
|
goto err_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ncs[i].peer->vring_enable) {
|
||||||
|
/* restore vring enable state */
|
||||||
|
r = vhost_set_vring_enable(ncs[i].peer, ncs[i].peer->vring_enable);
|
||||||
|
|
||||||
|
if (r < 0) {
|
||||||
|
goto err_start;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -422,6 +431,8 @@ int vhost_set_vring_enable(NetClientState *nc, int enable)
|
||||||
VHostNetState *net = get_vhost_net(nc);
|
VHostNetState *net = get_vhost_net(nc);
|
||||||
const VhostOps *vhost_ops;
|
const VhostOps *vhost_ops;
|
||||||
|
|
||||||
|
nc->vring_enable = enable;
|
||||||
|
|
||||||
if (!net) {
|
if (!net) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,7 @@ struct NetClientState {
|
||||||
NetClientDestructor *destructor;
|
NetClientDestructor *destructor;
|
||||||
unsigned int queue_index;
|
unsigned int queue_index;
|
||||||
unsigned rxfilter_notify_enabled:1;
|
unsigned rxfilter_notify_enabled:1;
|
||||||
|
int vring_enable;
|
||||||
QTAILQ_HEAD(NetFilterHead, NetFilterState) filters;
|
QTAILQ_HEAD(NetFilterHead, NetFilterState) filters;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue