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:38 +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 3/4] rdma: Add support to get CQ in raw format

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

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

$rdma res show cq dev mlx5_2 cqn 1 -r -j
[{"ifindex":8,"ifname":"mlx5_2","cqn":1,"cqe":1023,"users":4,
"poll-ctx":"UNBOUND_WORKQUEUE","adaptive-moderation":"on",
"comm":"ib_core", "data":[0,4,255,254,0,0,0,0,0,0,0,0,16,28,...]}]

Signed-off-by: Maor Gottlieb <maorg@...lanox.com>
Signed-off-by: Leon Romanovsky <leonro@...lanox.com>
---
 rdma/res-cq.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/rdma/res-cq.c b/rdma/res-cq.c
index e1efe3ba..d34b5245 100644
--- a/rdma/res-cq.c
+++ b/rdma/res-cq.c
@@ -39,9 +39,21 @@ static void print_cq_dim_setting(struct rd *rd, struct nlattr *attr)
 	print_on_off(rd, "adaptive-moderation", dim_setting);
 }

+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_CQE] ||
+	    !nla_line[RDMA_NLDEV_ATTR_RES_USECNT])
+		return false;
+	return true;
+}
+
 static int res_cq_line(struct rd *rd, const char *name, int idx,
 		       struct nlattr **nla_line)
 {
+	bool raw = rd->show_raw;
 	char *comm = NULL;
 	uint32_t pid = 0;
 	uint8_t poll_ctx = 0;
@@ -50,8 +62,7 @@ static int res_cq_line(struct rd *rd, const char *name, int idx,
 	uint64_t users;
 	uint32_t cqe;

-	if (!nla_line[RDMA_NLDEV_ATTR_RES_CQE] ||
-	    !nla_line[RDMA_NLDEV_ATTR_RES_USECNT])
+	if (!resp_is_valid(nla_line, raw))
 		return MNL_CB_ERROR;

 	cqe = mnl_attr_get_u32(nla_line[RDMA_NLDEV_ATTR_RES_CQE]);
@@ -107,6 +118,7 @@ static int res_cq_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:	if (nla_line[RDMA_NLDEV_ATTR_RES_PID])
--
2.26.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ