All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yuri Benditovich <yuri.benditovich@daynix.com>
To: mst@redhat.com, jasowang@redhat.com, qemu-devel@nongnu.org
Cc: yan@daynix.com
Subject: [PATCH 2/3] net: add ability to hide (disable) vhost_net
Date: Thu,  4 Feb 2021 22:29:14 +0200	[thread overview]
Message-ID: <20210204202915.15925-3-yuri.benditovich@daynix.com> (raw)
In-Reply-To: <20210204202915.15925-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 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



  parent reply	other threads:[~2021-02-04 20:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04 20:29 [PATCH 0/3] virtio-net: graceful drop of vhost for TAP Yuri Benditovich
2021-02-04 20:29 ` [PATCH 1/3] vhost-net: add VIRTIO_NET_F_HASH_REPORT to the list of kernel features Yuri Benditovich
2021-02-04 20:29 ` Yuri Benditovich [this message]
2021-02-04 20:29 ` [PATCH 3/3] virtio-net: graceful fallback to vhost=off for tap netdev Yuri Benditovich
2021-02-05 13:38   ` Michael S. Tsirkin
2021-02-05 13:43     ` Michael S. Tsirkin
2021-02-08  3:15     ` Jason Wang
2021-02-08 19:46       ` Yuri Benditovich
2021-02-09  3:39         ` Jason Wang
2021-02-08  4:11   ` Jason Wang
2021-02-08 19:59     ` Yuri Benditovich
2021-02-09  3:45       ` Jason Wang
2021-02-09 14:34 ` [PATCH 0/3] virtio-net: graceful drop of vhost for TAP Michael S. Tsirkin
2021-02-09 14:51   ` Daniel P. Berrangé
2021-02-09 15:04     ` Michael S. Tsirkin
2021-02-09 15:18       ` Daniel P. Berrangé
2021-02-10  6:19       ` Jason Wang
2021-02-10  8:38         ` Michael S. Tsirkin
2021-02-18  3:02           ` Jason Wang
2021-02-18  9:35         ` Daniel P. Berrangé
2021-02-18 19:55           ` Yuri Benditovich
2021-02-19  9:35             ` Daniel P. Berrangé
2021-02-18  9:30       ` Daniel P. Berrangé

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=20210204202915.15925-3-yuri.benditovich@daynix.com \
    --to=yuri.benditovich@daynix.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.