lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 20 May 2020 13:25:39 +0300
From:   Leon Romanovsky <leon@...nel.org>
To:     David Ahern <dsahern@...il.com>
Cc:     Maor Gottlieb <maorg@...lanox.com>,
        netdev <netdev@...r.kernel.org>,
        RDMA mailing list <linux-rdma@...r.kernel.org>,
        Stephen Hemminger <stephen@...workplumber.org>
Subject: [PATCH iproute2-next 4/4] rdma: Add support to get MR in raw format

From: Maor Gottlieb <maorg@...lanox.com>

Add the required support to print MR data in raw format.
Example:

$rdma res show mr dev mlx5_1 mrn 2 -r -j
[{"ifindex":7,"ifname":"mlx5_1","mrn":2,"mrlen":4096,"pdn":5, pid":24336,
"comm":"ibv_rc_pingpong","data":[0,4,255,254,0,0,0,0,0,0,0,0,16,28,0,216,...]}]

Signed-off-by: Maor Gottlieb <maorg@...lanox.com>
Signed-off-by: Leon Romanovsky <leonro@...lanox.com>
---
 rdma/res-mr.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/rdma/res-mr.c b/rdma/res-mr.c
index c1366035..b6e0a6a9 100644
--- a/rdma/res-mr.c
+++ b/rdma/res-mr.c
@@ -7,17 +7,27 @@
 #include "res.h"
 #include <inttypes.h>

+static bool resp_is_valid(struct nlattr **nla_line, bool raw)
+{
+	if (raw)
+		return nla_line[RDMA_NLDEV_ATTR_RES_RAW] ? true : false;
+	if (!nla_line[RDMA_NLDEV_ATTR_RES_MRLEN])
+		return MNL_CB_ERROR;
+	return true;
+}
+
 static int res_mr_line(struct rd *rd, const char *name, int idx,
 		       struct nlattr **nla_line)
 {
 	uint32_t rkey = 0, lkey = 0;
 	uint64_t iova = 0, mrlen;
+	bool raw = rd->show_raw;
 	char *comm = NULL;
 	uint32_t pdn = 0;
 	uint32_t mrn = 0;
 	uint32_t pid = 0;

-	if (!nla_line[RDMA_NLDEV_ATTR_RES_MRLEN])
+	if (!resp_is_valid(nla_line, raw))
 		return MNL_CB_ERROR;

 	if (nla_line[RDMA_NLDEV_ATTR_RES_RKEY])
@@ -69,6 +79,7 @@ static int res_mr_line(struct rd *rd, const char *name, int idx,
 	print_comm(rd, comm, nla_line);

 	print_driver_table(rd, nla_line[RDMA_NLDEV_ATTR_DRIVER]);
+	print_raw_data(rd, nla_line);
 	newline(rd);

 out:
--
2.26.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ