* [PATCH iproute2-rc v1 0/2] Fix rdmatool JSON conversion
@ 2020-08-11 7:31 Leon Romanovsky
2020-08-11 7:32 ` [PATCH iproute2-rc v1 1/2] rdma: Fix owner name for the kernel resources Leon Romanovsky
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Leon Romanovsky @ 2020-08-11 7:31 UTC (permalink / raw)
To: Stephen Hemminger, David Ahern
Cc: Leon Romanovsky, Doug Ledford, Jason Gunthorpe, linux-netdev,
RDMA mailing list
From: Leon Romanovsky <leonro@nvidia.com>
Changelog:
v1:
* Added extra patch
* Don't print [] in owner name in JSON output
v0:
https://lore.kernel.org/linux-rdma/20200811063304.581395-1-leon@kernel.org
---------------------------------------------------------------------------
Two fixes to RDMAtool JSON/CLI prints.
Leon Romanovsky (2):
rdma: Fix owner name for the kernel resources
rdma: Properly print device and link names in CLI output
rdma/res.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
--
2.26.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH iproute2-rc v1 1/2] rdma: Fix owner name for the kernel resources
2020-08-11 7:31 [PATCH iproute2-rc v1 0/2] Fix rdmatool JSON conversion Leon Romanovsky
@ 2020-08-11 7:32 ` Leon Romanovsky
2020-08-11 7:32 ` [PATCH iproute2-rc v1 2/2] rdma: Properly print device and link names in CLI output Leon Romanovsky
2020-08-16 7:58 ` [PATCH iproute2-rc v1 0/2] Fix rdmatool JSON conversion Leon Romanovsky
2 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2020-08-11 7:32 UTC (permalink / raw)
To: Stephen Hemminger, David Ahern
Cc: Leon Romanovsky, Doug Ledford, Jason Gunthorpe, linux-netdev,
RDMA mailing list
From: Leon Romanovsky <leonro@nvidia.com>
Owner of kernel resources is printed in different format than user
resources to easy with the reader by simply looking on the name.
The kernel owner will have "[ ]" around the name.
Before this change:
[leonro@vm ~]$ rdma res show qp
link rocep0s9/1 lqpn 1 type GSI state RTS sq-psn 58 comm ib_core
After this change:
[leonro@vm ~]$ rdma res show qp
link rocep0s9/1 lqpn 1 type GSI state RTS sq-psn 58 comm [ib_core]
Fixes: b0a688a542cd ("rdma: Rewrite custom JSON and prints logic to use common API")
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
rdma/res.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rdma/res.c b/rdma/res.c
index c99a1fcb..b7a703f8 100644
--- a/rdma/res.c
+++ b/rdma/res.c
@@ -157,11 +157,11 @@ void print_comm(struct rd *rd, const char *str, struct nlattr **nla_line)
if (!str)
return;
- if (nla_line[RDMA_NLDEV_ATTR_RES_PID])
+ if (nla_line[RDMA_NLDEV_ATTR_RES_PID] || rd->json_output)
snprintf(tmp, sizeof(tmp), "%s", str);
else
snprintf(tmp, sizeof(tmp), "[%s]", str);
- print_color_string(PRINT_ANY, COLOR_NONE, "comm", "comm %s ", str);
+ print_color_string(PRINT_ANY, COLOR_NONE, "comm", "comm %s ", tmp);
}
void print_dev(struct rd *rd, uint32_t idx, const char *name)
--
2.26.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH iproute2-rc v1 2/2] rdma: Properly print device and link names in CLI output
2020-08-11 7:31 [PATCH iproute2-rc v1 0/2] Fix rdmatool JSON conversion Leon Romanovsky
2020-08-11 7:32 ` [PATCH iproute2-rc v1 1/2] rdma: Fix owner name for the kernel resources Leon Romanovsky
@ 2020-08-11 7:32 ` Leon Romanovsky
2020-08-16 22:48 ` Stephen Hemminger
2020-08-16 7:58 ` [PATCH iproute2-rc v1 0/2] Fix rdmatool JSON conversion Leon Romanovsky
2 siblings, 1 reply; 6+ messages in thread
From: Leon Romanovsky @ 2020-08-11 7:32 UTC (permalink / raw)
To: Stephen Hemminger, David Ahern
Cc: Leon Romanovsky, Doug Ledford, Jason Gunthorpe, linux-netdev,
RDMA mailing list
From: Leon Romanovsky <leonro@nvidia.com>
The citied commit broke the CLI output and printed ifindex/ifname
instead of dev/link.
Before:
[leonro@vm ~]$ rdma res show qp
link mlx5_0/lqpn 1 type GSI state RTS sq-psn 0 comm ib_core
[leonro@vm ~]$ rdma res show cq
ifindex 0 ifname rocep0s9 cqn 0 cqe 1023 users 2 poll-ctx WORKQUEUE adaptive-moderation on comm ib_core
After:
[leonro@vm ~]$ rdma res show qp
link mlx5_0/- lqpn 1 type GSI state RTS sq-psn 0 comm [ib_core]
[leonro@vm ~]$ rdma res show cq
dev rocep0s9 cqn 0 cqe 1023 users 2 poll-ctx WORKQUEUE adaptive-moderation on comm [ib_core]
It was missed because rdmatool mostly used in JSON mode.
Fixes: b0a688a542cd ("rdma: Rewrite custom JSON and prints logic to use common API")
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
rdma/res.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/rdma/res.c b/rdma/res.c
index b7a703f8..dc12bbe4 100644
--- a/rdma/res.c
+++ b/rdma/res.c
@@ -166,17 +166,27 @@ void print_comm(struct rd *rd, const char *str, struct nlattr **nla_line)
void print_dev(struct rd *rd, uint32_t idx, const char *name)
{
- print_color_int(PRINT_ANY, COLOR_NONE, "ifindex", "ifindex %d ", idx);
- print_color_string(PRINT_ANY, COLOR_NONE, "ifname", "ifname %s ", name);
+ print_color_int(PRINT_ANY, COLOR_NONE, "ifindex", NULL, idx);
+ print_color_string(PRINT_ANY, COLOR_NONE, "ifname", "dev %s ", name);
}
void print_link(struct rd *rd, uint32_t idx, const char *name, uint32_t port,
struct nlattr **nla_line)
{
+ char tmp[64] = {};
+
print_color_uint(PRINT_JSON, COLOR_NONE, "ifindex", NULL, idx);
- print_color_string(PRINT_ANY, COLOR_NONE, "ifname", "link %s/", name);
- if (nla_line[RDMA_NLDEV_ATTR_PORT_INDEX])
- print_color_uint(PRINT_ANY, COLOR_NONE, "port", "%u ", port);
+ print_color_string(PRINT_ANY, COLOR_NONE, "ifname", NULL, name);
+ if (nla_line[RDMA_NLDEV_ATTR_PORT_INDEX]) {
+ print_color_uint(PRINT_ANY, COLOR_NONE, "port", NULL, port);
+ snprintf(tmp, sizeof(tmp), "%s/%d", name, port);
+ } else {
+ snprintf(tmp, sizeof(tmp), "%s/-", name);
+ }
+
+ if (!rd->json_output)
+ print_color_string(PRINT_ANY, COLOR_NONE, NULL, "link %s ",
+ tmp);
}
void print_qp_type(struct rd *rd, uint32_t val)
--
2.26.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH iproute2-rc v1 0/2] Fix rdmatool JSON conversion
2020-08-11 7:31 [PATCH iproute2-rc v1 0/2] Fix rdmatool JSON conversion Leon Romanovsky
2020-08-11 7:32 ` [PATCH iproute2-rc v1 1/2] rdma: Fix owner name for the kernel resources Leon Romanovsky
2020-08-11 7:32 ` [PATCH iproute2-rc v1 2/2] rdma: Properly print device and link names in CLI output Leon Romanovsky
@ 2020-08-16 7:58 ` Leon Romanovsky
2 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2020-08-16 7:58 UTC (permalink / raw)
To: Stephen Hemminger, David Ahern
Cc: Doug Ledford, Jason Gunthorpe, linux-netdev, RDMA mailing list
On Tue, Aug 11, 2020 at 10:31:59AM +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@nvidia.com>
>
> Changelog:
> v1:
> * Added extra patch
> * Don't print [] in owner name in JSON output
> v0:
> https://lore.kernel.org/linux-rdma/20200811063304.581395-1-leon@kernel.org
> ---------------------------------------------------------------------------
>
> Two fixes to RDMAtool JSON/CLI prints.
>
> Leon Romanovsky (2):
> rdma: Fix owner name for the kernel resources
> rdma: Properly print device and link names in CLI output
>
> rdma/res.c | 24 +++++++++++++++++-------
> 1 file changed, 17 insertions(+), 7 deletions(-)
Stephen, David
Is anything expected from me before merging the fixes?
Thanks
>
> --
> 2.26.2
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH iproute2-rc v1 2/2] rdma: Properly print device and link names in CLI output
2020-08-11 7:32 ` [PATCH iproute2-rc v1 2/2] rdma: Properly print device and link names in CLI output Leon Romanovsky
@ 2020-08-16 22:48 ` Stephen Hemminger
2020-08-17 7:44 ` Leon Romanovsky
0 siblings, 1 reply; 6+ messages in thread
From: Stephen Hemminger @ 2020-08-16 22:48 UTC (permalink / raw)
To: Leon Romanovsky
Cc: David Ahern, Leon Romanovsky, Doug Ledford, Jason Gunthorpe,
linux-netdev, RDMA mailing list
On Tue, 11 Aug 2020 10:32:01 +0300
Leon Romanovsky <leon@kernel.org> wrote:
> + print_color_string(PRINT_ANY, COLOR_NONE, "ifname", "dev %s ", name);
Since this is an interface name, you might want to consider using COLOR_IFNAME?
I will go ahead and apply it as is but more work is needed here.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH iproute2-rc v1 2/2] rdma: Properly print device and link names in CLI output
2020-08-16 22:48 ` Stephen Hemminger
@ 2020-08-17 7:44 ` Leon Romanovsky
0 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2020-08-17 7:44 UTC (permalink / raw)
To: Stephen Hemminger
Cc: David Ahern, Doug Ledford, Jason Gunthorpe, linux-netdev,
RDMA mailing list
On Sun, Aug 16, 2020 at 03:48:46PM -0700, Stephen Hemminger wrote:
> On Tue, 11 Aug 2020 10:32:01 +0300
> Leon Romanovsky <leon@kernel.org> wrote:
>
> > + print_color_string(PRINT_ANY, COLOR_NONE, "ifname", "dev %s ", name);
>
> Since this is an interface name, you might want to consider using COLOR_IFNAME?
>
> I will go ahead and apply it as is but more work is needed here.
Thanks for taking care.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-08-17 7:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-11 7:31 [PATCH iproute2-rc v1 0/2] Fix rdmatool JSON conversion Leon Romanovsky
2020-08-11 7:32 ` [PATCH iproute2-rc v1 1/2] rdma: Fix owner name for the kernel resources Leon Romanovsky
2020-08-11 7:32 ` [PATCH iproute2-rc v1 2/2] rdma: Properly print device and link names in CLI output Leon Romanovsky
2020-08-16 22:48 ` Stephen Hemminger
2020-08-17 7:44 ` Leon Romanovsky
2020-08-16 7:58 ` [PATCH iproute2-rc v1 0/2] Fix rdmatool JSON conversion 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).