qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH RFC 1/4] net: Introduce qmp cmd "query-netdev"


From: Thomas Huth
Subject: Re: [PATCH RFC 1/4] net: Introduce qmp cmd "query-netdev"
Date: Wed, 2 Nov 2022 08:10:54 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0

On 02/11/2022 06.42, Jason Wang wrote:
On Tue, Nov 1, 2022 at 12:19 AM <huangy81@chinatelecom.cn> wrote:

From: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>

For netdev device that can offload virtio-net dataplane to slave,
such as vhost-net, vhost-user and vhost-vdpa, exporting it's
capability information and acked features would be more friendly for
developers. These infomation can be analyzed and compare to slave
capability provided by, eg dpdk or other slaves directly, helping to
draw conclusions about if vm network interface works normally, if
it vm can be migrated to another feature-compatible destination or
whatever else.

For developers who devote to offload virtio-net dataplane to DPU
and make efforts to migrate vm lively from software-based source
host to DPU-offload destination host smoothly, virtio-net feature
compatibility is an serious issue, exporting the key capability
and acked_features of netdev could also help to debug greatly.

So we export out the key capabilities of netdev, which may affect
the final negotiated virtio-net features, meanwhile, backed-up
acked_features also exported, which is used to initialize or
restore features negotiated between qemu and vhost slave when
starting vhost_dev device.

Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
---
  net/net.c     | 44 +++++++++++++++++++++++++++++++++++++++
  qapi/net.json | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 110 insertions(+)

diff --git a/net/net.c b/net/net.c
index 2db160e..5d11674 100644
--- a/net/net.c
+++ b/net/net.c
@@ -53,6 +53,7 @@
  #include "sysemu/runstate.h"
  #include "net/colo-compare.h"
  #include "net/filter.h"
+#include "net/vhost-user.h"
  #include "qapi/string-output-visitor.h"

  /* Net bridge is currently not supported for W32. */
@@ -1224,6 +1225,49 @@ void qmp_netdev_del(const char *id, Error **errp)
      }
  }

+static NetDevInfo *query_netdev(NetClientState *nc)
+{
+    NetDevInfo *info = NULL;
+
+    if (!nc || !nc->is_netdev) {
+        return NULL;
+    }
+
+    info = g_malloc0(sizeof(*info));
+    info->name = g_strdup(nc->name);
+    info->type = nc->info->type;
+    info->ufo = nc->info->has_ufo;
+    info->vnet_hdr = nc->info->has_vnet_hdr;
+    info->vnet_hdr_len = nc->info->has_vnet_hdr_len;

So all the fields are virtio specific, I wonder if it's better to
rename the command as query-vhost or query-virtio?

And add a "x-" prefix (and a "-netdev" suffix) as long as we don't feel confident about this yet? "x-query-virtio-netdev" ?

 Thomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]