summaryrefslogtreecommitdiffstats
path: root/monitor/qmp-cmds.c
diff options
context:
space:
mode:
authorDaniel P. Berrangé2021-09-08 11:35:43 +0200
committerDaniel P. Berrangé2021-11-02 16:55:14 +0100
commit8dbbca5c056842d53498f643a15cac8593d51424 (patch)
tree7644cfc5c677565e0f610f8f76fbd8796d612897 /monitor/qmp-cmds.c
parentqapi: introduce x-query-usb QMP command (diff)
downloadqemu-8dbbca5c056842d53498f643a15cac8593d51424.tar.gz
qemu-8dbbca5c056842d53498f643a15cac8593d51424.tar.xz
qemu-8dbbca5c056842d53498f643a15cac8593d51424.zip
qapi: introduce x-query-rdma QMP command
This is a counterpart to the HMP "info rdma" command. It is being added with an "x-" prefix because this QMP command is intended as an adhoc debugging tool and will thus not be modelled in QAPI as fully structured data, nor will it have long term guaranteed stability. The existing HMP command is rewritten to call the QMP command. Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'monitor/qmp-cmds.c')
-rw-r--r--monitor/qmp-cmds.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
index 6122ad18b6..0a9ba7595c 100644
--- a/monitor/qmp-cmds.c
+++ b/monitor/qmp-cmds.c
@@ -40,6 +40,7 @@
#include "qapi/qmp/qerror.h"
#include "hw/mem/memory-device.h"
#include "hw/acpi/acpi_dev_interface.h"
+#include "hw/rdma/rdma.h"
NameInfo *qmp_query_name(Error **errp)
{
@@ -382,3 +383,34 @@ HumanReadableText *qmp_x_query_profile(Error **errp)
return NULL;
}
#endif
+
+static int qmp_x_query_rdma_foreach(Object *obj, void *opaque)
+{
+ RdmaProvider *rdma;
+ RdmaProviderClass *k;
+ GString *buf = opaque;
+
+ if (object_dynamic_cast(obj, INTERFACE_RDMA_PROVIDER)) {
+ rdma = RDMA_PROVIDER(obj);
+ k = RDMA_PROVIDER_GET_CLASS(obj);
+ if (k->format_statistics) {
+ k->format_statistics(rdma, buf);
+ } else {
+ g_string_append_printf(buf,
+ "RDMA statistics not available for %s.\n",
+ object_get_typename(obj));
+ }
+ }
+
+ return 0;
+}
+
+HumanReadableText *qmp_x_query_rdma(Error **errp)
+{
+ g_autoptr(GString) buf = g_string_new("");
+
+ object_child_foreach_recursive(object_get_root(),
+ qmp_x_query_rdma_foreach, buf);
+
+ return human_readable_text_from_str(buf);
+}