qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Yuri Benditovich <yuri.benditovich@daynix.com>
To: mst@redhat.com, jasowang@redhat.com, berrange@redhat.com
Cc: yan@daynix.com, qemu-devel@nongnu.org
Subject: [RFC PATCH v2 1/3] net: add ability to hide (disable) vhost_net
Date: Mon, 22 Mar 2021 14:24:50 +0200	[thread overview]
Message-ID: <20210322122452.369750-2-yuri.benditovich@daynix.com> (raw)
In-Reply-To: <20210322122452.369750-1-yuri.benditovich@daynix.com>

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 24d555e764..6660efd9ea 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -436,7 +436,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 a02949f6db..a938211524 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -103,6 +103,7 @@ struct NetClientState {
     int vring_enable;
     int vnet_hdr_len;
     bool is_netdev;
+    bool vhost_net_disabled;
     QTAILQ_HEAD(, NetFilterState) filters;
 };
 
-- 
2.26.2



  reply	other threads:[~2021-03-22 12:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 12:24 [RFC PATCH v2 0/3] virtio-net: graceful drop of vhost for TAP Yuri Benditovich
2021-03-22 12:24 ` Yuri Benditovich [this message]
2021-03-22 12:24 ` [RFC PATCH v2 2/3] virtio: introduce 'missing_features_migrated' device callback Yuri Benditovich
2021-03-22 12:24 ` [RFC PATCH v2 3/3] virtio-net: implement missing_features_migrated callback Yuri Benditovich
2021-03-25  6:59 ` [RFC PATCH v2 0/3] virtio-net: graceful drop of vhost for TAP Jason Wang
2021-03-25  9:00   ` Yuri Benditovich
2021-03-26  7:51     ` Jason Wang
2021-03-26  9:09       ` Yuri Benditovich
2021-03-26  9:18         ` Jason Wang
2021-04-02  5:05           ` Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210322122452.369750-2-yuri.benditovich@daynix.com \
    --to=yuri.benditovich@daynix.com \
    --cc=berrange@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yan@daynix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).