aboutsummaryrefslogtreecommitdiff
path: root/hw/rdma/rdma_rm.c
diff options
context:
space:
mode:
authorYuval Shaia <yuval.shaia@oracle.com>2019-03-11 03:29:09 -0700
committerMarcel Apfelbaum <marcel.apfelbaum@gmail.com>2019-03-16 15:52:44 +0200
commitf4b2c02a2911b164474b998532b1a963fc9b785b (patch)
tree79f2982c291e4f2a78a3892699982f1150b4d419 /hw/rdma/rdma_rm.c
parentc2dd117b38583f89d6a2e4a6dfc6d693990ffc39 (diff)
{hmp, hw/pvrdma}: Expose device internals via monitor interface
Allow interrogating device internals through HMP interface. The exposed indicators can be used for troubleshooting by developers or sysadmin. There is no need to expose these attributes to a management system (e.x. libvirt) because (1) most of them are not "device-management' related info and (2) there is no guarantee the interface is stable. Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Acked-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1552300155-25216-6-git-send-email-yuval.shaia@oracle.com> Reviewed-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com> Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Diffstat (limited to 'hw/rdma/rdma_rm.c')
-rw-r--r--hw/rdma/rdma_rm.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/hw/rdma/rdma_rm.c b/hw/rdma/rdma_rm.c
index 35fa1ab44e..b50e192b49 100644
--- a/hw/rdma/rdma_rm.c
+++ b/hw/rdma/rdma_rm.c
@@ -16,6 +16,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "cpu.h"
+#include "monitor/monitor.h"
#include "trace.h"
#include "rdma_utils.h"
@@ -26,6 +27,58 @@
#define PG_DIR_SZ { TARGET_PAGE_SIZE / sizeof(__u64) }
#define PG_TBL_SZ { TARGET_PAGE_SIZE / sizeof(__u64) }
+void rdma_dump_device_counters(Monitor *mon, RdmaDeviceResources *dev_res)
+{
+ monitor_printf(mon, "\ttx : %" PRId64 "\n",
+ dev_res->stats.tx);
+ monitor_printf(mon, "\ttx_len : %" PRId64 "\n",
+ dev_res->stats.tx_len);
+ monitor_printf(mon, "\ttx_err : %" PRId64 "\n",
+ dev_res->stats.tx_err);
+ monitor_printf(mon, "\trx_bufs : %" PRId64 "\n",
+ dev_res->stats.rx_bufs);
+ monitor_printf(mon, "\trx_bufs_len : %" PRId64 "\n",
+ dev_res->stats.rx_bufs_len);
+ monitor_printf(mon, "\trx_bufs_err : %" PRId64 "\n",
+ dev_res->stats.rx_bufs_err);
+ monitor_printf(mon, "\tcomps : %" PRId64 "\n",
+ dev_res->stats.completions);
+ monitor_printf(mon, "\tmissing_comps : %" PRId32 "\n",
+ dev_res->stats.missing_cqe);
+ monitor_printf(mon, "\tpoll_cq (bk) : %" PRId64 "\n",
+ dev_res->stats.poll_cq_from_bk);
+ monitor_printf(mon, "\tpoll_cq_ppoll_to : %" PRId64 "\n",
+ dev_res->stats.poll_cq_ppoll_to);
+ monitor_printf(mon, "\tpoll_cq (fe) : %" PRId64 "\n",
+ dev_res->stats.poll_cq_from_guest);
+ monitor_printf(mon, "\tpoll_cq_empty : %" PRId64 "\n",
+ dev_res->stats.poll_cq_from_guest_empty);
+ monitor_printf(mon, "\tmad_tx : %" PRId64 "\n",
+ dev_res->stats.mad_tx);
+ monitor_printf(mon, "\tmad_tx_err : %" PRId64 "\n",
+ dev_res->stats.mad_tx_err);
+ monitor_printf(mon, "\tmad_rx : %" PRId64 "\n",
+ dev_res->stats.mad_rx);
+ monitor_printf(mon, "\tmad_rx_err : %" PRId64 "\n",
+ dev_res->stats.mad_rx_err);
+ monitor_printf(mon, "\tmad_rx_bufs : %" PRId64 "\n",
+ dev_res->stats.mad_rx_bufs);
+ monitor_printf(mon, "\tmad_rx_bufs_err : %" PRId64 "\n",
+ dev_res->stats.mad_rx_bufs_err);
+ monitor_printf(mon, "\tPDs : %" PRId32 "\n",
+ dev_res->pd_tbl.used);
+ monitor_printf(mon, "\tMRs : %" PRId32 "\n",
+ dev_res->mr_tbl.used);
+ monitor_printf(mon, "\tUCs : %" PRId32 "\n",
+ dev_res->uc_tbl.used);
+ monitor_printf(mon, "\tQPs : %" PRId32 "\n",
+ dev_res->qp_tbl.used);
+ monitor_printf(mon, "\tCQs : %" PRId32 "\n",
+ dev_res->cq_tbl.used);
+ monitor_printf(mon, "\tCEQ_CTXs : %" PRId32 "\n",
+ dev_res->cqe_ctx_tbl.used);
+}
+
static inline void res_tbl_init(const char *name, RdmaRmResTbl *tbl,
uint32_t tbl_sz, uint32_t res_sz)
{