Message ID | 20210204202915.15925-3-yuri.benditovich@daynix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | virtio-net: graceful drop of vhost for TAP | expand |
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 8282e440bd..7873d27a36 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -437,7 +437,9 @@ VHostNetState *get_vhost_net(NetClientState *nc) switch (nc->info->type) { case NET_CLIENT_DRIVER_TAP: - vhost_net = tap_get_vhost_net(nc); + if (!nc->vhost_net_disabled) { + vhost_net = tap_get_vhost_net(nc); + } break; #ifdef CONFIG_VHOST_NET_USER case NET_CLIENT_DRIVER_VHOST_USER: diff --git a/include/net/net.h b/include/net/net.h index 919facaad2..4479bdcec0 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -100,6 +100,7 @@ struct NetClientState { int vring_enable; int vnet_hdr_len; bool is_netdev; + bool vhost_net_disabled; QTAILQ_HEAD(, NetFilterState) filters; };
If 'vhost_net_disabled' in the NetClientState of the net device, get_vhost_net for TAP returns NULL. Network adapters can use this ability to hide the vhost_net temporary between resets in case some active features contradict with vhost. Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com> --- hw/net/vhost_net.c | 4 +++- include/net/net.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)