* [PATCH iproute2] tc: add json support to size table
@ 2022-11-23 4:49 Stephen Hemminger
2022-11-23 6:40 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2022-11-23 4:49 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
Fix the JSON output if size addaption table is used.
Example:
[ {
"kind": "fq_codel",
"handle": "1:",
"dev": "enp2s0",
"root": true,
"refcnt": 2,
"options": {
"limit": 10240,
"flows": 1024,
"quantum": 1514,
"target": 4999,
"interval": 99999,
"memory_limit": 33554432,
"ecn": true,
"drop_batch": 64
},
"stab": {
"overhead": 30,
"mpu": 68,
"mtu": 2047,
"tsize": 512
}
} ]
Remove fixed prefix arg and no longer needed fp arg.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
tc/tc_common.h | 2 +-
tc/tc_qdisc.c | 2 +-
tc/tc_stab.c | 22 ++++++++++++++--------
3 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/tc/tc_common.h b/tc/tc_common.h
index 58dc9d6a6c4f..f1561d80a43b 100644
--- a/tc/tc_common.h
+++ b/tc/tc_common.h
@@ -16,7 +16,7 @@ int print_action(struct nlmsghdr *n, void *arg);
int print_filter(struct nlmsghdr *n, void *arg);
int print_qdisc(struct nlmsghdr *n, void *arg);
int print_class(struct nlmsghdr *n, void *arg);
-void print_size_table(FILE *fp, const char *prefix, struct rtattr *rta);
+void print_size_table(struct rtattr *rta);
struct tc_estimator;
int parse_estimator(int *p_argc, char ***p_argv, struct tc_estimator *est);
diff --git a/tc/tc_qdisc.c b/tc/tc_qdisc.c
index b79029d96202..33a6665eaac0 100644
--- a/tc/tc_qdisc.c
+++ b/tc/tc_qdisc.c
@@ -329,7 +329,7 @@ int print_qdisc(struct nlmsghdr *n, void *arg)
print_nl();
if (show_details && tb[TCA_STAB]) {
- print_size_table(fp, " ", tb[TCA_STAB]);
+ print_size_table(tb[TCA_STAB]);
print_nl();
}
diff --git a/tc/tc_stab.c b/tc/tc_stab.c
index c61ecfd200ca..06dc1b134d85 100644
--- a/tc/tc_stab.c
+++ b/tc/tc_stab.c
@@ -103,7 +103,7 @@ int parse_size_table(int *argcp, char ***argvp, struct tc_sizespec *sp)
return 0;
}
-void print_size_table(FILE *fp, const char *prefix, struct rtattr *rta)
+void print_size_table(struct rtattr *rta)
{
struct rtattr *tb[TCA_STAB_MAX + 1];
@@ -117,17 +117,23 @@ void print_size_table(FILE *fp, const char *prefix, struct rtattr *rta)
memcpy(&s, RTA_DATA(tb[TCA_STAB_BASE]),
MIN(RTA_PAYLOAD(tb[TCA_STAB_BASE]), sizeof(s)));
- fprintf(fp, "%s", prefix);
+ print_string(PRINT_FP, NULL, " ", NULL);
+
if (s.linklayer)
- fprintf(fp, "linklayer %s ",
- sprint_linklayer(s.linklayer, b1));
+ print_string(PRINT_ANY, "linklayer",
+ "linklayer %s ",
+ sprint_linklayer(s.linklayer, b1));
if (s.overhead)
- fprintf(fp, "overhead %d ", s.overhead);
+ print_int(PRINT_ANY, "overhead",
+ "overhead %d ", s.overhead);
if (s.mpu)
- fprintf(fp, "mpu %u ", s.mpu);
+ print_uint(PRINT_ANY, "mpu",
+ "mpu %u ", s.mpu);
if (s.mtu)
- fprintf(fp, "mtu %u ", s.mtu);
+ print_uint(PRINT_ANY, "mtu",
+ "mtu %u ", s.mtu);
if (s.tsize)
- fprintf(fp, "tsize %u ", s.tsize);
+ print_uint(PRINT_ANY, "tsize",
+ "tsize %u ", s.tsize);
}
}
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH iproute2] tc: add json support to size table
2022-11-23 4:49 [PATCH iproute2] tc: add json support to size table Stephen Hemminger
@ 2022-11-23 6:40 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-23 6:40 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
Hello:
This patch was applied to iproute2/iproute2.git (main)
by Stephen Hemminger <stephen@networkplumber.org>:
On Tue, 22 Nov 2022 20:49:49 -0800 you wrote:
> Fix the JSON output if size addaption table is used.
>
> Example:
> [ {
> "kind": "fq_codel",
> "handle": "1:",
> "dev": "enp2s0",
> "root": true,
> "refcnt": 2,
> "options": {
> "limit": 10240,
> "flows": 1024,
> "quantum": 1514,
> "target": 4999,
> "interval": 99999,
> "memory_limit": 33554432,
> "ecn": true,
> "drop_batch": 64
> },
> "stab": {
> "overhead": 30,
> "mpu": 68,
> "mtu": 2047,
> "tsize": 512
> }
> } ]
>
> [...]
Here is the summary with links:
- [iproute2] tc: add json support to size table
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=6af6f02cce42
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-23 6:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-23 4:49 [PATCH iproute2] tc: add json support to size table Stephen Hemminger
2022-11-23 6:40 ` patchwork-bot+netdevbpf
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).