linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2-next v1 0/4] RAW format dumps through RDMAtool
@ 2020-06-24 10:40 Leon Romanovsky
  2020-06-24 10:40 ` [PATCH iproute2-next v1 1/4] rdma: update uapi headers Leon Romanovsky
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Leon Romanovsky @ 2020-06-24 10:40 UTC (permalink / raw)
  To: David Ahern
  Cc: Leon Romanovsky, Doug Ledford, Jason Gunthorpe, linux-netdev,
	Maor Gottlieb, RDMA mailing list

From: Leon Romanovsky <leonro@mellanox.com>

Changelog:
v1:
 * Kernel part was accepted, so this series has correct SHA for the
   kernel header update patch.
 * Aligned implementation to the final kernel solution of query
   interface.
v0:
https://lore.kernel.org/linux-rdma/20200520102539.458983-1-leon@kernel.org

-----------------------------------------------------------------------------

Hi,

The following series adds support to get the RDMA resource data in RAW
format. The main motivation for doing this is to enable vendors to
return the entire QP/CQ/MR data without a need from the vendor to set
each field separately.

Thanks

Maor Gottlieb (4):
  rdma: update uapi headers
  rdma: Add support to get QP in raw format
  rdma: Add support to get CQ in raw format
  rdma: Add support to get MR in raw format

 man/man8/rdma-resource.8              |  5 +++++
 man/man8/rdma.8                       |  4 ++++
 rdma/include/uapi/rdma/rdma_netlink.h |  8 +++++++
 rdma/rdma.c                           | 10 +++++++--
 rdma/rdma.h                           |  7 +++++--
 rdma/res-cq.c                         | 20 ++++++++++++++++--
 rdma/res-mr.c                         | 21 +++++++++++++++++--
 rdma/res-qp.c                         | 20 ++++++++++++++++--
 rdma/res.h                            | 30 ++++++++++++++++++++++-----
 rdma/utils.c                          | 20 ++++++++++++++++++
 10 files changed, 130 insertions(+), 15 deletions(-)

--
2.26.2


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH iproute2-next v1 1/4] rdma: update uapi headers
  2020-06-24 10:40 [PATCH iproute2-next v1 0/4] RAW format dumps through RDMAtool Leon Romanovsky
@ 2020-06-24 10:40 ` Leon Romanovsky
  2020-06-25  8:15   ` Leon Romanovsky
  2020-07-05 15:02   ` David Ahern
  2020-06-24 10:40 ` [PATCH iproute2-next v1 2/4] rdma: Add support to get QP in raw format Leon Romanovsky
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 13+ messages in thread
From: Leon Romanovsky @ 2020-06-24 10:40 UTC (permalink / raw)
  To: David Ahern
  Cc: Maor Gottlieb, Doug Ledford, Jason Gunthorpe, linux-netdev,
	RDMA mailing list

From: Maor Gottlieb <maorg@mellanox.com>

Update rdma_netlink.h file upto kernel commit ba1f4991cc55
("RDMA: Add support to dump resource tracker in RAW format")

Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 rdma/include/uapi/rdma/rdma_netlink.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/rdma/include/uapi/rdma/rdma_netlink.h b/rdma/include/uapi/rdma/rdma_netlink.h
index ae5a77a1..fe127b88 100644
--- a/rdma/include/uapi/rdma/rdma_netlink.h
+++ b/rdma/include/uapi/rdma/rdma_netlink.h
@@ -287,6 +287,12 @@ enum rdma_nldev_command {
 
 	RDMA_NLDEV_CMD_STAT_DEL,
 
+	RDMA_NLDEV_CMD_RES_QP_GET_RAW, /* can dump */
+
+	RDMA_NLDEV_CMD_RES_CQ_GET_RAW, /* can dump */
+
+	RDMA_NLDEV_CMD_RES_MR_GET_RAW, /* can dump */
+
 	RDMA_NLDEV_NUM_OPS
 };
 
@@ -525,6 +531,8 @@ enum rdma_nldev_attr {
 	 */
 	RDMA_NLDEV_ATTR_DEV_DIM,                /* u8 */
 
+	RDMA_NLDEV_ATTR_RES_RAW,                /* binary */
+
 	/*
 	 * Always the end
 	 */
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH iproute2-next v1 2/4] rdma: Add support to get QP in raw format
  2020-06-24 10:40 [PATCH iproute2-next v1 0/4] RAW format dumps through RDMAtool Leon Romanovsky
  2020-06-24 10:40 ` [PATCH iproute2-next v1 1/4] rdma: update uapi headers Leon Romanovsky
@ 2020-06-24 10:40 ` Leon Romanovsky
  2020-06-24 10:40 ` [PATCH iproute2-next v1 3/4] rdma: Add support to get CQ " Leon Romanovsky
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Leon Romanovsky @ 2020-06-24 10:40 UTC (permalink / raw)
  To: David Ahern
  Cc: Maor Gottlieb, Doug Ledford, Jason Gunthorpe, linux-netdev,
	RDMA mailing list

From: Maor Gottlieb <maorg@mellanox.com>

Add 'raw' argument to get the resource in raw format.
When RDMA_NLDEV_ATTR_RES_RAW is set in the netlink message,
then the resource fields are in raw format, print it as byte array.

Example:
$rdma res show qp link rocep0s12f0/1 lqpn 1137 -j -r
[{"ifindex":7,"ifname":"mlx5_1","port":1,
"data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,...]}]

Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 man/man8/rdma-resource.8 |  5 +++++
 man/man8/rdma.8          |  4 ++++
 rdma/rdma.c              | 10 ++++++++--
 rdma/rdma.h              |  7 +++++--
 rdma/res-qp.c            | 20 ++++++++++++++++++--
 rdma/res.h               | 26 +++++++++++++++++++++-----
 rdma/utils.c             | 20 ++++++++++++++++++++
 7 files changed, 81 insertions(+), 11 deletions(-)

diff --git a/man/man8/rdma-resource.8 b/man/man8/rdma-resource.8
index 05030d0a..8d0d14c6 100644
--- a/man/man8/rdma-resource.8
+++ b/man/man8/rdma-resource.8
@@ -83,6 +83,11 @@ rdma res show qp link mlx5_4/1 lqpn 0-6
 Limit to specific Local QPNs.
 .RE
 .PP
+rdma res show qp link mlx5_4/1 lqpn 6 -r
+.RS 4
+Driver specific details in raw format.
+.RE
+.PP
 rdma resource show cm_id dst-port 7174
 .RS 4
 Show CM_IDs with destination ip port of 7174.
diff --git a/man/man8/rdma.8 b/man/man8/rdma.8
index 221bf334..c9e5d50d 100644
--- a/man/man8/rdma.8
+++ b/man/man8/rdma.8
@@ -51,6 +51,10 @@ If there were any errors during execution of the commands, the application retur
 .BR "\-d" , " --details"
 Output detailed information.  Adding a second \-d includes driver-specific details.
 
+.TP
+.BR "\-r" , " --raw"
+Output includes driver-specific details in raw format.
+
 .TP
 .BR "\-p" , " --pretty"
 When combined with -j generate a pretty JSON output.
diff --git a/rdma/rdma.c b/rdma/rdma.c
index 22050555..c24894d6 100644
--- a/rdma/rdma.c
+++ b/rdma/rdma.c
@@ -13,7 +13,7 @@ static void help(char *name)
 	pr_out("Usage: %s [ OPTIONS ] OBJECT { COMMAND | help }\n"
 	       "       %s [ -f[orce] ] -b[atch] filename\n"
 	       "where  OBJECT := { dev | link | resource | system | statistic | help }\n"
-	       "       OPTIONS := { -V[ersion] | -d[etails] | -j[son] | -p[retty]}\n", name, name);
+	       "       OPTIONS := { -V[ersion] | -d[etails] | -j[son] | -p[retty] -r[aw]}\n", name, name);
 }
 
 static int cmd_help(struct rd *rd)
@@ -112,6 +112,7 @@ int main(int argc, char **argv)
 		{ "json",		no_argument,		NULL, 'j' },
 		{ "pretty",		no_argument,		NULL, 'p' },
 		{ "details",		no_argument,		NULL, 'd' },
+		{ "raw",		no_argument,		NULL, 'r' },
 		{ "force",		no_argument,		NULL, 'f' },
 		{ "batch",		required_argument,	NULL, 'b' },
 		{ NULL, 0, NULL, 0 }
@@ -120,6 +121,7 @@ int main(int argc, char **argv)
 	const char *batch_file = NULL;
 	bool show_details = false;
 	bool json_output = false;
+	bool show_raw = false;
 	bool force = false;
 	struct rd rd = {};
 	char *filename;
@@ -127,7 +129,7 @@ int main(int argc, char **argv)
 	int err;
 	filename = basename(argv[0]);
 
-	while ((opt = getopt_long(argc, argv, ":Vhdpjfb:",
+	while ((opt = getopt_long(argc, argv, ":Vhdrpjfb:",
 				  long_options, NULL)) >= 0) {
 		switch (opt) {
 		case 'V':
@@ -143,6 +145,9 @@ int main(int argc, char **argv)
 			else
 				show_details = true;
 			break;
+		case 'r':
+			show_raw = true;
+			break;
 		case 'j':
 			json_output = 1;
 			break;
@@ -172,6 +177,7 @@ int main(int argc, char **argv)
 	rd.show_driver_details = show_driver_details;
 	rd.json_output = json_output;
 	rd.pretty_output = pretty;
+	rd.show_raw = show_raw;
 
 	err = rd_init(&rd, filename);
 	if (err)
diff --git a/rdma/rdma.h b/rdma/rdma.h
index 735b1bf7..a6c6bdea 100644
--- a/rdma/rdma.h
+++ b/rdma/rdma.h
@@ -57,8 +57,9 @@ struct rd {
 	int argc;
 	char **argv;
 	char *filename;
-	bool show_details;
-	bool show_driver_details;
+	uint8_t show_details:1;
+	uint8_t show_driver_details:1;
+	uint8_t show_raw:1;
 	struct list_head dev_map_list;
 	uint32_t dev_idx;
 	uint32_t port_idx;
@@ -134,9 +135,11 @@ int rd_attr_check(const struct nlattr *attr, int *typep);
  * Print helpers
  */
 void print_driver_table(struct rd *rd, struct nlattr *tb);
+void print_raw_data(struct rd *rd, struct nlattr **nla_line);
 void newline(struct rd *rd);
 void newline_indent(struct rd *rd);
 void print_on_off(struct rd *rd, const char *key_str, bool on);
+void print_raw_data(struct rd *rd, struct nlattr **nla_line);
 #define MAX_LINE_LENGTH 80
 
 #endif /* _RDMA_TOOL_H_ */
diff --git a/rdma/res-qp.c b/rdma/res-qp.c
index 801cfca9..a38be399 100644
--- a/rdma/res-qp.c
+++ b/rdma/res-qp.c
@@ -64,6 +64,20 @@ static void print_pathmig(struct rd *rd, uint32_t val, struct nlattr **nla_line)
 			   "path-mig-state %s ", path_mig_to_str(val));
 }
 
+static int res_qp_line_raw(struct rd *rd, const char *name, int idx,
+			   struct nlattr **nla_line)
+{
+	if (!nla_line[RDMA_NLDEV_ATTR_RES_RAW])
+		return MNL_CB_ERROR;
+
+	open_json_object(NULL);
+	print_link(rd, idx, name, rd->port_idx, nla_line);
+	print_raw_data(rd, nla_line);
+	newline(rd);
+
+	return MNL_CB_OK;
+}
+
 static int res_qp_line(struct rd *rd, const char *name, int idx,
 		       struct nlattr **nla_line)
 {
@@ -184,7 +198,8 @@ int res_qp_idx_parse_cb(const struct nlmsghdr *nlh, void *data)
 	name = mnl_attr_get_str(tb[RDMA_NLDEV_ATTR_DEV_NAME]);
 	idx = mnl_attr_get_u32(tb[RDMA_NLDEV_ATTR_DEV_INDEX]);
 
-	return res_qp_line(rd, name, idx, tb);
+	return (rd->show_raw) ? res_qp_line_raw(rd, name, idx, tb) :
+		res_qp_line(rd, name, idx, tb);
 }
 
 int res_qp_parse_cb(const struct nlmsghdr *nlh, void *data)
@@ -212,7 +227,8 @@ int res_qp_parse_cb(const struct nlmsghdr *nlh, void *data)
 		if (ret != MNL_CB_OK)
 			break;
 
-		ret = res_qp_line(rd, name, idx, nla_line);
+		ret = (rd->show_raw) ? res_qp_line_raw(rd, name, idx, nla_line) :
+			res_qp_line(rd, name, idx, nla_line);
 		if (ret != MNL_CB_OK)
 			break;
 	}
diff --git a/rdma/res.h b/rdma/res.h
index 525171fc..24eee2a1 100644
--- a/rdma/res.h
+++ b/rdma/res.h
@@ -23,24 +23,40 @@ int res_cm_id_idx_parse_cb(const struct nlmsghdr *nlh, void *data);
 int res_qp_parse_cb(const struct nlmsghdr *nlh, void *data);
 int res_qp_idx_parse_cb(const struct nlmsghdr *nlh, void *data);
 
+static inline uint32_t res_get_command(uint32_t command, struct rd *rd)
+{
+	if (!rd->show_raw)
+		return command;
+
+	switch (command) {
+	case RDMA_NLDEV_CMD_RES_QP_GET:
+		return RDMA_NLDEV_CMD_RES_QP_GET_RAW;
+	default:
+		return command;
+	}
+}
+
 #define RES_FUNC(name, command, valid_filters, strict_port, id)                        \
 	static inline int _##name(struct rd *rd)                                       \
 	{                                                                              \
-		uint32_t idx;                                                          \
+		uint32_t idx, _command;                                                \
 		int ret;                                                               \
+		_command = res_get_command(command, rd);			       \
 		if (id) {                                                              \
 			ret = rd_doit_index(rd, &idx);                                 \
 			if (ret) {                                                     \
 				rd->suppress_errors = true;                            \
-				ret = _res_send_idx_msg(rd, command,                   \
+				ret = _res_send_idx_msg(rd, _command,                  \
 							name##_idx_parse_cb,           \
 							idx, id);                      \
-				if (!ret)                                              \
+				if (!ret || rd->show_raw)                              \
 					return ret;                                    \
-				/* Fallback for old systems without .doit callbacks */ \
+				/* Fallback for old systems without .doit callbacks.   \
+				 * Kernel that supports raw, for sure supports doit.   \
+				 */						       \
 			}                                                              \
 		}                                                                      \
-		return _res_send_msg(rd, command, name##_parse_cb);                    \
+		return _res_send_msg(rd, _command, name##_parse_cb);                   \
 	}                                                                              \
 	static inline int name(struct rd *rd)                                          \
 	{                                                                              \
diff --git a/rdma/utils.c b/rdma/utils.c
index e25c3adf..4d3de4fa 100644
--- a/rdma/utils.c
+++ b/rdma/utils.c
@@ -450,6 +450,7 @@ static const enum mnl_attr_data_type nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
 	[RDMA_NLDEV_ATTR_STAT_RES] = MNL_TYPE_U32,
 	[RDMA_NLDEV_ATTR_STAT_AUTO_MODE_MASK] = MNL_TYPE_U32,
 	[RDMA_NLDEV_ATTR_DEV_DIM] = MNL_TYPE_U8,
+	[RDMA_NLDEV_ATTR_RES_RAW] = MNL_TYPE_BINARY,
 };
 
 int rd_attr_check(const struct nlattr *attr, int *typep)
@@ -890,6 +891,25 @@ static int print_driver_entry(struct rd *rd, struct nlattr *key_attr,
 	return ret;
 }
 
+void print_raw_data(struct rd *rd, struct nlattr **nla_line)
+{
+	uint8_t *data;
+	uint32_t len;
+	int i = 0;
+
+	if (!rd->show_raw)
+		return;
+
+	len = mnl_attr_get_payload_len(nla_line[RDMA_NLDEV_ATTR_RES_RAW]);
+	data = mnl_attr_get_payload(nla_line[RDMA_NLDEV_ATTR_RES_RAW]);
+	open_json_array(PRINT_JSON, "data");
+	while (i < len) {
+		print_color_uint(PRINT_ANY, COLOR_NONE, NULL, "%d", data[i]);
+		i++;
+	}
+	close_json_array(PRINT_ANY, ">");
+}
+
 void print_driver_table(struct rd *rd, struct nlattr *tb)
 {
 	int print_type = RDMA_NLDEV_PRINT_TYPE_UNSPEC;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH iproute2-next v1 3/4] rdma: Add support to get CQ in raw format
  2020-06-24 10:40 [PATCH iproute2-next v1 0/4] RAW format dumps through RDMAtool Leon Romanovsky
  2020-06-24 10:40 ` [PATCH iproute2-next v1 1/4] rdma: update uapi headers Leon Romanovsky
  2020-06-24 10:40 ` [PATCH iproute2-next v1 2/4] rdma: Add support to get QP in raw format Leon Romanovsky
@ 2020-06-24 10:40 ` Leon Romanovsky
  2020-06-24 10:40 ` [PATCH iproute2-next v1 4/4] rdma: Add support to get MR " Leon Romanovsky
  2020-07-05 18:14 ` [PATCH iproute2-next v1 0/4] RAW format dumps through RDMAtool David Ahern
  4 siblings, 0 replies; 13+ messages in thread
From: Leon Romanovsky @ 2020-06-24 10:40 UTC (permalink / raw)
  To: David Ahern
  Cc: Maor Gottlieb, Doug Ledford, Jason Gunthorpe, linux-netdev,
	RDMA mailing list

From: Maor Gottlieb <maorg@mellanox.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",
"data":[0,4,255,254,0,0,0,0,0,0,0,0,16,28,...]}]

Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 rdma/res-cq.c | 20 ++++++++++++++++++--
 rdma/res.h    |  2 ++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/rdma/res-cq.c b/rdma/res-cq.c
index e1efe3ba..313f929a 100644
--- a/rdma/res-cq.c
+++ b/rdma/res-cq.c
@@ -39,6 +39,20 @@ static void print_cq_dim_setting(struct rd *rd, struct nlattr *attr)
 	print_on_off(rd, "adaptive-moderation", dim_setting);
 }
 
+static int res_cq_line_raw(struct rd *rd, const char *name, int idx,
+			   struct nlattr **nla_line)
+{
+	if (!nla_line[RDMA_NLDEV_ATTR_RES_RAW])
+		return MNL_CB_ERROR;
+
+	open_json_object(NULL);
+	print_dev(rd, idx, name);
+	print_raw_data(rd, nla_line);
+	newline(rd);
+
+	return MNL_CB_OK;
+}
+
 static int res_cq_line(struct rd *rd, const char *name, int idx,
 		       struct nlattr **nla_line)
 {
@@ -128,7 +142,8 @@ int res_cq_idx_parse_cb(const struct nlmsghdr *nlh, void *data)
 	name = mnl_attr_get_str(tb[RDMA_NLDEV_ATTR_DEV_NAME]);
 	idx = mnl_attr_get_u32(tb[RDMA_NLDEV_ATTR_DEV_INDEX]);
 
-	return res_cq_line(rd, name, idx, tb);
+	return (rd->show_raw) ? res_cq_line_raw(rd, name, idx, tb) :
+		res_cq_line(rd, name, idx, tb);
 }
 
 int res_cq_parse_cb(const struct nlmsghdr *nlh, void *data)
@@ -156,7 +171,8 @@ int res_cq_parse_cb(const struct nlmsghdr *nlh, void *data)
 		if (ret != MNL_CB_OK)
 			break;
 
-		ret = res_cq_line(rd, name, idx, nla_line);
+		ret = (rd->show_raw) ? res_cq_line_raw(rd, name, idx, nla_line) :
+			res_cq_line(rd, name, idx, nla_line);
 
 		if (ret != MNL_CB_OK)
 			break;
diff --git a/rdma/res.h b/rdma/res.h
index 24eee2a1..bb0f19e0 100644
--- a/rdma/res.h
+++ b/rdma/res.h
@@ -31,6 +31,8 @@ static inline uint32_t res_get_command(uint32_t command, struct rd *rd)
 	switch (command) {
 	case RDMA_NLDEV_CMD_RES_QP_GET:
 		return RDMA_NLDEV_CMD_RES_QP_GET_RAW;
+	case RDMA_NLDEV_CMD_RES_CQ_GET:
+		return RDMA_NLDEV_CMD_RES_CQ_GET_RAW;
 	default:
 		return command;
 	}
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH iproute2-next v1 4/4] rdma: Add support to get MR in raw format
  2020-06-24 10:40 [PATCH iproute2-next v1 0/4] RAW format dumps through RDMAtool Leon Romanovsky
                   ` (2 preceding siblings ...)
  2020-06-24 10:40 ` [PATCH iproute2-next v1 3/4] rdma: Add support to get CQ " Leon Romanovsky
@ 2020-06-24 10:40 ` Leon Romanovsky
  2020-07-05 18:14 ` [PATCH iproute2-next v1 0/4] RAW format dumps through RDMAtool David Ahern
  4 siblings, 0 replies; 13+ messages in thread
From: Leon Romanovsky @ 2020-06-24 10:40 UTC (permalink / raw)
  To: David Ahern
  Cc: Maor Gottlieb, Doug Ledford, Jason Gunthorpe, linux-netdev,
	RDMA mailing list

From: Maor Gottlieb <maorg@mellanox.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",
"data":[0,4,255,254,0,0,0,0,0,0,0,0,16,28,0,216,...]}]

Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 rdma/res-mr.c | 21 +++++++++++++++++++--
 rdma/res.h    |  2 ++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/rdma/res-mr.c b/rdma/res-mr.c
index c1366035..1bf73f3a 100644
--- a/rdma/res-mr.c
+++ b/rdma/res-mr.c
@@ -7,6 +7,20 @@
 #include "res.h"
 #include <inttypes.h>
 
+static int res_mr_line_raw(struct rd *rd, const char *name, int idx,
+			   struct nlattr **nla_line)
+{
+	if (!nla_line[RDMA_NLDEV_ATTR_RES_RAW])
+		return MNL_CB_ERROR;
+
+	open_json_object(NULL);
+	print_dev(rd, idx, name);
+	print_raw_data(rd, nla_line);
+	newline(rd);
+
+	return MNL_CB_OK;
+}
+
 static int res_mr_line(struct rd *rd, const char *name, int idx,
 		       struct nlattr **nla_line)
 {
@@ -69,6 +83,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:
@@ -91,7 +106,8 @@ int res_mr_idx_parse_cb(const struct nlmsghdr *nlh, void *data)
 	name = mnl_attr_get_str(tb[RDMA_NLDEV_ATTR_DEV_NAME]);
 	idx = mnl_attr_get_u32(tb[RDMA_NLDEV_ATTR_DEV_INDEX]);
 
-	return res_mr_line(rd, name, idx, tb);
+	return (rd->show_raw) ? res_mr_line_raw(rd, name, idx, tb) :
+		res_mr_line(rd, name, idx, tb);
 }
 
 int res_mr_parse_cb(const struct nlmsghdr *nlh, void *data)
@@ -119,7 +135,8 @@ int res_mr_parse_cb(const struct nlmsghdr *nlh, void *data)
 		if (ret != MNL_CB_OK)
 			break;
 
-		ret = res_mr_line(rd, name, idx, nla_line);
+		ret = (rd->show_raw) ? res_mr_line_raw(rd, name, idx, nla_line) :
+			res_mr_line(rd, name, idx, nla_line);
 		if (ret != MNL_CB_OK)
 			break;
 	}
diff --git a/rdma/res.h b/rdma/res.h
index bb0f19e0..70ce5758 100644
--- a/rdma/res.h
+++ b/rdma/res.h
@@ -33,6 +33,8 @@ static inline uint32_t res_get_command(uint32_t command, struct rd *rd)
 		return RDMA_NLDEV_CMD_RES_QP_GET_RAW;
 	case RDMA_NLDEV_CMD_RES_CQ_GET:
 		return RDMA_NLDEV_CMD_RES_CQ_GET_RAW;
+	case RDMA_NLDEV_CMD_RES_MR_GET:
+		return RDMA_NLDEV_CMD_RES_MR_GET_RAW;
 	default:
 		return command;
 	}
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH iproute2-next v1 1/4] rdma: update uapi headers
  2020-06-24 10:40 ` [PATCH iproute2-next v1 1/4] rdma: update uapi headers Leon Romanovsky
@ 2020-06-25  8:15   ` Leon Romanovsky
  2020-06-26  5:00     ` David Ahern
  2020-07-05 15:02   ` David Ahern
  1 sibling, 1 reply; 13+ messages in thread
From: Leon Romanovsky @ 2020-06-25  8:15 UTC (permalink / raw)
  To: David Ahern
  Cc: Maor Gottlieb, Doug Ledford, Jason Gunthorpe, linux-netdev,
	RDMA mailing list

On Wed, Jun 24, 2020 at 01:40:09PM +0300, Leon Romanovsky wrote:
> From: Maor Gottlieb <maorg@mellanox.com>
>
> Update rdma_netlink.h file upto kernel commit ba1f4991cc55
> ("RDMA: Add support to dump resource tracker in RAW format")

David,

The SHA was changed because of the rebase on top of our testing branch.
65959522f806 RDMA: Add support to dump resource tracker in RAW format

Do you want me to resend the series?

Thanks

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH iproute2-next v1 1/4] rdma: update uapi headers
  2020-06-25  8:15   ` Leon Romanovsky
@ 2020-06-26  5:00     ` David Ahern
  0 siblings, 0 replies; 13+ messages in thread
From: David Ahern @ 2020-06-26  5:00 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Maor Gottlieb, Doug Ledford, Jason Gunthorpe, linux-netdev,
	RDMA mailing list

On 6/25/20 1:15 AM, Leon Romanovsky wrote:
> On Wed, Jun 24, 2020 at 01:40:09PM +0300, Leon Romanovsky wrote:
>> From: Maor Gottlieb <maorg@mellanox.com>
>>
>> Update rdma_netlink.h file upto kernel commit ba1f4991cc55
>> ("RDMA: Add support to dump resource tracker in RAW format")
> 
> David,
> 
> The SHA was changed because of the rebase on top of our testing branch.
> 65959522f806 RDMA: Add support to dump resource tracker in RAW format
> 
> Do you want me to resend the series?
> 

no need just for that; I can fix before applying.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH iproute2-next v1 1/4] rdma: update uapi headers
  2020-06-24 10:40 ` [PATCH iproute2-next v1 1/4] rdma: update uapi headers Leon Romanovsky
  2020-06-25  8:15   ` Leon Romanovsky
@ 2020-07-05 15:02   ` David Ahern
  2020-07-05 18:04     ` Leon Romanovsky
  1 sibling, 1 reply; 13+ messages in thread
From: David Ahern @ 2020-07-05 15:02 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Maor Gottlieb, Doug Ledford, Jason Gunthorpe, linux-netdev,
	RDMA mailing list

On 6/24/20 4:40 AM, Leon Romanovsky wrote:
> diff --git a/rdma/include/uapi/rdma/rdma_netlink.h b/rdma/include/uapi/rdma/rdma_netlink.h
> index ae5a77a1..fe127b88 100644
> --- a/rdma/include/uapi/rdma/rdma_netlink.h
> +++ b/rdma/include/uapi/rdma/rdma_netlink.h
> @@ -287,6 +287,12 @@ enum rdma_nldev_command {
>  
>  	RDMA_NLDEV_CMD_STAT_DEL,
>  
> +	RDMA_NLDEV_CMD_RES_QP_GET_RAW, /* can dump */
> +
> +	RDMA_NLDEV_CMD_RES_CQ_GET_RAW, /* can dump */
> +
> +	RDMA_NLDEV_CMD_RES_MR_GET_RAW, /* can dump */
> +
>  	RDMA_NLDEV_NUM_OPS
>  };

you are inserting new commands in the middle which breaks existing users
of this API.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH iproute2-next v1 1/4] rdma: update uapi headers
  2020-07-05 15:02   ` David Ahern
@ 2020-07-05 18:04     ` Leon Romanovsky
  2020-07-05 18:07       ` David Ahern
  0 siblings, 1 reply; 13+ messages in thread
From: Leon Romanovsky @ 2020-07-05 18:04 UTC (permalink / raw)
  To: David Ahern
  Cc: Maor Gottlieb, Doug Ledford, Jason Gunthorpe, linux-netdev,
	RDMA mailing list

On Sun, Jul 05, 2020 at 09:02:42AM -0600, David Ahern wrote:
> On 6/24/20 4:40 AM, Leon Romanovsky wrote:
> > diff --git a/rdma/include/uapi/rdma/rdma_netlink.h b/rdma/include/uapi/rdma/rdma_netlink.h
> > index ae5a77a1..fe127b88 100644
> > --- a/rdma/include/uapi/rdma/rdma_netlink.h
> > +++ b/rdma/include/uapi/rdma/rdma_netlink.h
> > @@ -287,6 +287,12 @@ enum rdma_nldev_command {
> >
> >  	RDMA_NLDEV_CMD_STAT_DEL,
> >
> > +	RDMA_NLDEV_CMD_RES_QP_GET_RAW, /* can dump */
> > +
> > +	RDMA_NLDEV_CMD_RES_CQ_GET_RAW, /* can dump */
> > +
> > +	RDMA_NLDEV_CMD_RES_MR_GET_RAW, /* can dump */
> > +
> >  	RDMA_NLDEV_NUM_OPS
> >  };
>
> you are inserting new commands in the middle which breaks existing users
> of this API.

RDMA_NLDEV_NUM_OPS is not a command, but enum item to help calculate array
size, exactly like devlink_command in include/uapi/linux/devlink.h.

Thanks

>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH iproute2-next v1 1/4] rdma: update uapi headers
  2020-07-05 18:04     ` Leon Romanovsky
@ 2020-07-05 18:07       ` David Ahern
  2020-07-06  5:33         ` Leon Romanovsky
  0 siblings, 1 reply; 13+ messages in thread
From: David Ahern @ 2020-07-05 18:07 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Maor Gottlieb, Doug Ledford, Jason Gunthorpe, linux-netdev,
	RDMA mailing list

On 7/5/20 12:04 PM, Leon Romanovsky wrote:
> RDMA_NLDEV_NUM_OPS is not a command, but enum item to help calculate array
> size, exactly like devlink_command in include/uapi/linux/devlink.h.

ok. usually the last field is __FOO_MAX not FOO_NUM.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH iproute2-next v1 0/4] RAW format dumps through RDMAtool
  2020-06-24 10:40 [PATCH iproute2-next v1 0/4] RAW format dumps through RDMAtool Leon Romanovsky
                   ` (3 preceding siblings ...)
  2020-06-24 10:40 ` [PATCH iproute2-next v1 4/4] rdma: Add support to get MR " Leon Romanovsky
@ 2020-07-05 18:14 ` David Ahern
  2020-07-06  5:34   ` Leon Romanovsky
  4 siblings, 1 reply; 13+ messages in thread
From: David Ahern @ 2020-07-05 18:14 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Leon Romanovsky, Doug Ledford, Jason Gunthorpe, linux-netdev,
	Maor Gottlieb, RDMA mailing list

On 6/24/20 4:40 AM, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
> 
> Changelog:
> v1:
>  * Kernel part was accepted, so this series has correct SHA for the
>    kernel header update patch.
>  * Aligned implementation to the final kernel solution of query
>    interface.
> v0:
> https://lore.kernel.org/linux-rdma/20200520102539.458983-1-leon@kernel.org
> 
> -----------------------------------------------------------------------------
> 
> Hi,
> 
> The following series adds support to get the RDMA resource data in RAW
> format. The main motivation for doing this is to enable vendors to
> return the entire QP/CQ/MR data without a need from the vendor to set
> each field separately.
> 

applied to iproute2-next. Thanks



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH iproute2-next v1 1/4] rdma: update uapi headers
  2020-07-05 18:07       ` David Ahern
@ 2020-07-06  5:33         ` Leon Romanovsky
  0 siblings, 0 replies; 13+ messages in thread
From: Leon Romanovsky @ 2020-07-06  5:33 UTC (permalink / raw)
  To: David Ahern
  Cc: Maor Gottlieb, Doug Ledford, Jason Gunthorpe, linux-netdev,
	RDMA mailing list

On Sun, Jul 05, 2020 at 12:07:31PM -0600, David Ahern wrote:
> On 7/5/20 12:04 PM, Leon Romanovsky wrote:
> > RDMA_NLDEV_NUM_OPS is not a command, but enum item to help calculate array
> > size, exactly like devlink_command in include/uapi/linux/devlink.h.
>
> ok. usually the last field is __FOO_MAX not FOO_NUM.

I used same naming style as we had for other enums in rdma_netlink.h.

Thanks

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH iproute2-next v1 0/4] RAW format dumps through RDMAtool
  2020-07-05 18:14 ` [PATCH iproute2-next v1 0/4] RAW format dumps through RDMAtool David Ahern
@ 2020-07-06  5:34   ` Leon Romanovsky
  0 siblings, 0 replies; 13+ messages in thread
From: Leon Romanovsky @ 2020-07-06  5:34 UTC (permalink / raw)
  To: David Ahern
  Cc: Doug Ledford, Jason Gunthorpe, linux-netdev, Maor Gottlieb,
	RDMA mailing list

On Sun, Jul 05, 2020 at 12:14:38PM -0600, David Ahern wrote:
> On 6/24/20 4:40 AM, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@mellanox.com>
> >
> > Changelog:
> > v1:
> >  * Kernel part was accepted, so this series has correct SHA for the
> >    kernel header update patch.
> >  * Aligned implementation to the final kernel solution of query
> >    interface.
> > v0:
> > https://lore.kernel.org/linux-rdma/20200520102539.458983-1-leon@kernel.org
> >
> > -----------------------------------------------------------------------------
> >
> > Hi,
> >
> > The following series adds support to get the RDMA resource data in RAW
> > format. The main motivation for doing this is to enable vendors to
> > return the entire QP/CQ/MR data without a need from the vendor to set
> > each field separately.
> >
>
> applied to iproute2-next. Thanks

Thanks

>
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-07-06  5:34 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-24 10:40 [PATCH iproute2-next v1 0/4] RAW format dumps through RDMAtool Leon Romanovsky
2020-06-24 10:40 ` [PATCH iproute2-next v1 1/4] rdma: update uapi headers Leon Romanovsky
2020-06-25  8:15   ` Leon Romanovsky
2020-06-26  5:00     ` David Ahern
2020-07-05 15:02   ` David Ahern
2020-07-05 18:04     ` Leon Romanovsky
2020-07-05 18:07       ` David Ahern
2020-07-06  5:33         ` Leon Romanovsky
2020-06-24 10:40 ` [PATCH iproute2-next v1 2/4] rdma: Add support to get QP in raw format Leon Romanovsky
2020-06-24 10:40 ` [PATCH iproute2-next v1 3/4] rdma: Add support to get CQ " Leon Romanovsky
2020-06-24 10:40 ` [PATCH iproute2-next v1 4/4] rdma: Add support to get MR " Leon Romanovsky
2020-07-05 18:14 ` [PATCH iproute2-next v1 0/4] RAW format dumps through RDMAtool David Ahern
2020-07-06  5:34   ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).