Blame SOURCES/0066-rdma-Add-MR-resource-tracking-information.patch

36cfb7
From a7f1b85b6838bdab705aef188bb0c86626bc3391 Mon Sep 17 00:00:00 2001
36cfb7
From: Andrea Claudi <aclaudi@redhat.com>
36cfb7
Date: Mon, 25 Mar 2019 13:31:02 +0100
36cfb7
Subject: [PATCH] rdma: Add MR resource tracking information
36cfb7
36cfb7
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1642479
36cfb7
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1641914
36cfb7
Upstream Status: iproute2.git commit 8958a15c040e0
36cfb7
Conflicts: remove rdma chunks due to missing files
36cfb7
36cfb7
commit 8958a15c040e05f4f2c6f3946322202fdb875348
36cfb7
Author: Steve Wise <swise@opengridcomputing.com>
36cfb7
Date:   Thu Mar 29 09:10:41 2018 -0700
36cfb7
36cfb7
    rdma: Add MR resource tracking information
36cfb7
36cfb7
    Sample output:
36cfb7
36cfb7
    Without CAP_NET_ADMIN:
36cfb7
36cfb7
    $ rdma resource show mr mrlen 65536
36cfb7
    dev mlx4_0 mrlen 65536 pid 0 comm [nvme_rdma]
36cfb7
    dev cxgb4_0 mrlen 65536 pid 0 comm [nvme_rdma]
36cfb7
36cfb7
    With CAP_NET_ADMIN:
36cfb7
36cfb7
    # rdma resource show mr mrlen 65536
36cfb7
    dev mlx4_0 rkey 0x12702 lkey 0x12702 iova 0x85724a000 mrlen 65536 pid 0 comm [nvme_rdma]
36cfb7
    dev cxgb4_0 rkey 0x68fe4e9 lkey 0x68fe4e9 iova 0x835b91000 mrlen 65536 pid 0 comm [nvme_rdma]
36cfb7
36cfb7
    Signed-off-by: Steve Wise <swise@opengridcomputing.com>
36cfb7
    Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
36cfb7
    Signed-off-by: David Ahern <dsahern@gmail.com>
36cfb7
---
36cfb7
 include/json_writer.h |  2 ++
36cfb7
 lib/json_writer.c     | 11 +++++++++++
36cfb7
 2 files changed, 13 insertions(+)
36cfb7
36cfb7
diff --git a/include/json_writer.h b/include/json_writer.h
36cfb7
index 1516aafba59df..34f2ccc2f5423 100644
36cfb7
--- a/include/json_writer.h
36cfb7
+++ b/include/json_writer.h
36cfb7
@@ -39,6 +39,7 @@ void jsonw_bool(json_writer_t *self, bool value);
36cfb7
 void jsonw_float(json_writer_t *self, double number);
36cfb7
 void jsonw_float_fmt(json_writer_t *self, const char *fmt, double num);
36cfb7
 void jsonw_uint(json_writer_t *self, uint64_t number);
36cfb7
+void jsonw_xint(json_writer_t *self, uint64_t number);
36cfb7
 void jsonw_hu(json_writer_t *self, unsigned short number);
36cfb7
 void jsonw_int(json_writer_t *self, int64_t number);
36cfb7
 void jsonw_null(json_writer_t *self);
36cfb7
@@ -49,6 +50,7 @@ void jsonw_string_field(json_writer_t *self, const char *prop, const char *val);
36cfb7
 void jsonw_bool_field(json_writer_t *self, const char *prop, bool value);
36cfb7
 void jsonw_float_field(json_writer_t *self, const char *prop, double num);
36cfb7
 void jsonw_uint_field(json_writer_t *self, const char *prop, uint64_t num);
36cfb7
+void jsonw_xint_field(json_writer_t *self, const char *prop, uint64_t num);
36cfb7
 void jsonw_hu_field(json_writer_t *self, const char *prop, unsigned short num);
36cfb7
 void jsonw_int_field(json_writer_t *self, const char *prop, int64_t num);
36cfb7
 void jsonw_null_field(json_writer_t *self, const char *prop);
36cfb7
diff --git a/lib/json_writer.c b/lib/json_writer.c
36cfb7
index 6b77d288cce2b..6aaa6b4170711 100644
36cfb7
--- a/lib/json_writer.c
36cfb7
+++ b/lib/json_writer.c
36cfb7
@@ -226,6 +226,11 @@ void jsonw_uint(json_writer_t *self, uint64_t num)
36cfb7
 	jsonw_printf(self, "%"PRIu64, num);
36cfb7
 }
36cfb7
 
36cfb7
+void jsonw_xint(json_writer_t *self, uint64_t num)
36cfb7
+{
36cfb7
+	jsonw_printf(self, "%"PRIx64, num);
36cfb7
+}
36cfb7
+
36cfb7
 void jsonw_lluint(json_writer_t *self, unsigned long long int num)
36cfb7
 {
36cfb7
 	jsonw_printf(self, "%llu", num);
36cfb7
@@ -272,6 +277,12 @@ void jsonw_uint_field(json_writer_t *self, const char *prop, uint64_t num)
36cfb7
 	jsonw_uint(self, num);
36cfb7
 }
36cfb7
 
36cfb7
+void jsonw_xint_field(json_writer_t *self, const char *prop, uint64_t num)
36cfb7
+{
36cfb7
+	jsonw_name(self, prop);
36cfb7
+	jsonw_xint(self, num);
36cfb7
+}
36cfb7
+
36cfb7
 void jsonw_hu_field(json_writer_t *self, const char *prop, unsigned short num)
36cfb7
 {
36cfb7
 	jsonw_name(self, prop);
36cfb7
-- 
36cfb7
2.20.1
36cfb7