[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/3] net: add ability to hide (disable) vhost_net
From: |
Yuri Benditovich |
Subject: |
[PATCH 2/3] net: add ability to hide (disable) vhost_net |
Date: |
Thu, 4 Feb 2021 22:29:14 +0200 |
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(-)
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;
};
--
2.17.1
Re: [PATCH 0/3] virtio-net: graceful drop of vhost for TAP, Michael S. Tsirkin, 2021/02/09