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>] [day] [month] [year] [list]
Message-Id: <9c6d0a4841f89d67d8370e5663397ada99c87635.1635157955.git.leonro@nvidia.com>
Date:   Mon, 25 Oct 2021 13:37:07 +0300
From:   Leon Romanovsky <leon@...nel.org>
To:     David Ahern <dsahern@...il.com>
Cc:     Neta Ostrovsky <netao@...dia.com>,
        linux-netdev <netdev@...r.kernel.org>,
        RDMA mailing list <linux-rdma@...r.kernel.org>
Subject: [PATCH iproute2-next] rdma: Fix SRQ resource tracking information json

From: Neta Ostrovsky <netao@...dia.com>

Fix the json output for the QPs that are associated with the SRQ -
The qpn are now displayed in a json array.

Sample output before the fix:
$ rdma res show srq lqpn 126-141 -j -p
[ {
        "ifindex":0,
	"ifname":"ibp8s0f0",
	"srqn":4,
	"type":"BASIC",
	"lqpn":["126-128,130-140"],
	"pdn":9,
	"pid":3581,
	"comm":"ibv_srq_pingpon"
    },{
	"ifindex":0,
	"ifname":"ibp8s0f0",
	"srqn":5,
	"type":"BASIC",
	"lqpn":["141"],
	"pdn":10,
	"pid":3584,
	"comm":"ibv_srq_pingpon"
    } ]

Sample output after the fix:
$ rdma res show srq lqpn 126-141 -j -p
[ {
        "ifindex":0,
	"ifname":"ibp8s0f0",
	"srqn":4,
	"type":"BASIC",
	"lqpn":["126-128","130-140"],
	"pdn":9,
	"pid":3581,
	"comm":"ibv_srq_pingpon"
    },{
	"ifindex":0,
	"ifname":"ibp8s0f0",
	"srqn":5,
	"type":"BASIC",
	"lqpn":["141"],
	"pdn":10,
	"pid":3584,
	"comm":"ibv_srq_pingpon"
    } ]

Fixes: 9b272e138d23 ("rdma: Add SRQ resource tracking information")
Signed-off-by: Neta Ostrovsky <netao@...dia.com>
Signed-off-by: Leon Romanovsky <leonro@...dia.com>
---
 rdma/res-srq.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/rdma/res-srq.c b/rdma/res-srq.c
index c14ac5d8..5d8f3842 100644
--- a/rdma/res-srq.c
+++ b/rdma/res-srq.c
@@ -26,11 +26,24 @@ static void print_type(struct rd *rd, uint32_t val)
 			   srq_types_to_str(val));
 }
 
-static void print_qps(const char *str)
+static void print_qps(char *qp_str)
 {
-	if (!strlen(str))
+	char *qpn;
+
+	if (!strlen(qp_str))
 		return;
-	print_color_string(PRINT_ANY, COLOR_NONE, "lqpn", "lqpn %s ", str);
+
+	open_json_array(PRINT_ANY, "lqpn");
+	print_color_string(PRINT_FP, COLOR_NONE, NULL, " ", NULL);
+	qpn = strtok(qp_str, ",");
+	while (qpn) {
+		print_color_string(PRINT_ANY, COLOR_NONE, NULL, "%s", qpn);
+		qpn = strtok(NULL, ",");
+		if (qpn)
+			print_color_string(PRINT_FP, COLOR_NONE, NULL, ",", NULL);
+	}
+	print_color_string(PRINT_FP, COLOR_NONE, NULL, " ", NULL);
+	close_json_array(PRINT_JSON, NULL);
 }
 
 static int filter_srq_range_qps(struct rd *rd, struct nlattr **qp_line,
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ