public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Victor Nogueira <victor@mojatatu.com>
To: stephen@networkplumber.org, dsahern@kernel.org
Cc: jhs@mojatatu.com, deren.teo@outlook.com, andrew@lunn.ch,
	netdev@vger.kernel.org
Subject: [PATCH iproute2 v2 3/3] tc: Add JSON output support to multiq
Date: Tue,  3 Mar 2026 10:07:33 -0300	[thread overview]
Message-ID: <20260303130733.540278-4-victor@mojatatu.com> (raw)
In-Reply-To: <20260303130733.540278-1-victor@mojatatu.com>

Since qdisc core already assumes all qdiscs are able to output JSON,
add JSON output support to multiq.

Fixes: c91d262f414d ("tc: jsonify qdisc core")
Signed-off-by: Victor Nogueira <victor@mojatatu.com>
---
 tc/q_multiq.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tc/q_multiq.c b/tc/q_multiq.c
index 63fffed4..0e8e2f9e 100644
--- a/tc/q_multiq.c
+++ b/tc/q_multiq.c
@@ -51,6 +51,7 @@ static int multiq_parse_opt(const struct qdisc_util *qu, int argc, char **argv,
 static int multiq_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 {
 	struct tc_multiq_qopt *qopt;
+	SPRINT_BUF(b1);
 
 	if (opt == NULL)
 		return 0;
@@ -59,7 +60,10 @@ static int multiq_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr
 
 	qopt = RTA_DATA(opt);
 
-	fprintf(f, "bands %u/%u ", qopt->bands, qopt->max_bands);
+	snprintf(b1, SPRINT_BSIZE, "%u/%u", qopt->bands, qopt->max_bands);
+	print_string(PRINT_FP, NULL, "bands %s ", b1);
+	print_uint(PRINT_JSON, "bands", NULL, qopt->bands);
+	print_uint(PRINT_JSON, "max_bands", NULL, qopt->max_bands);
 
 	return 0;
 }
-- 
2.53.0


  parent reply	other threads:[~2026-03-03 13:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-03 13:07 [PATCH iproute2 v2 0/3] Add JSON output support to the remaining qdiscs Victor Nogueira
2026-03-03 13:07 ` [PATCH iproute2 v2 1/3] tc: Add JSON output support to HFSC Victor Nogueira
2026-03-03 13:07 ` [PATCH iproute2 v2 2/3] tc: Add JSON output support to QFQ Victor Nogueira
2026-03-03 13:07 ` Victor Nogueira [this message]
2026-03-07  1:20 ` [PATCH iproute2 v2 0/3] Add JSON output support to the remaining qdiscs patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260303130733.540278-4-victor@mojatatu.com \
    --to=victor@mojatatu.com \
    --cc=andrew@lunn.ch \
    --cc=deren.teo@outlook.com \
    --cc=dsahern@kernel.org \
    --cc=jhs@mojatatu.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox