|
|
8792a8 |
From 148b286b52aa8f38d8d7587b598522310067de7b Mon Sep 17 00:00:00 2001
|
|
|
8792a8 |
Message-Id: <148b286b52aa8f38d8d7587b598522310067de7b.1628790091.git.aclaudi@redhat.com>
|
|
|
8792a8 |
In-Reply-To: <650694eb0120722499207078f965442ef7343bb1.1628790091.git.aclaudi@redhat.com>
|
|
|
8792a8 |
References: <650694eb0120722499207078f965442ef7343bb1.1628790091.git.aclaudi@redhat.com>
|
|
|
8792a8 |
From: Andrea Claudi <aclaudi@redhat.com>
|
|
|
8792a8 |
Date: Wed, 11 Aug 2021 12:55:14 +0200
|
|
|
8792a8 |
Subject: [PATCH] police: Fix normal output back to what it was
|
|
|
8792a8 |
|
|
|
8792a8 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1981393
|
|
|
8792a8 |
Upstream Status: iproute2.git commit 71d36000
|
|
|
8792a8 |
|
|
|
8792a8 |
commit 71d36000dc9ce8397fc45b680e0c0340df5a28e5
|
|
|
8792a8 |
Author: Roi Dayan <roid@nvidia.com>
|
|
|
8792a8 |
Date: Mon Jul 12 15:26:53 2021 +0300
|
|
|
8792a8 |
|
|
|
8792a8 |
police: Fix normal output back to what it was
|
|
|
8792a8 |
|
|
|
8792a8 |
With the json support fix the normal output was
|
|
|
8792a8 |
changed. set it back to what it was.
|
|
|
8792a8 |
Print overhead with print_size().
|
|
|
8792a8 |
Print newline before ref.
|
|
|
8792a8 |
|
|
|
8792a8 |
Fixes: 0d5cf51e0d6c ("police: Add support for json output")
|
|
|
8792a8 |
Signed-off-by: Roi Dayan <roid@nvidia.com>
|
|
|
8792a8 |
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
|
|
|
8792a8 |
|
|
|
8792a8 |
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
|
|
|
8792a8 |
---
|
|
|
8792a8 |
tc/m_police.c | 10 ++++++----
|
|
|
8792a8 |
1 file changed, 6 insertions(+), 4 deletions(-)
|
|
|
8792a8 |
|
|
|
8792a8 |
diff --git a/tc/m_police.c b/tc/m_police.c
|
|
|
8792a8 |
index 2594c089..f38ab90a 100644
|
|
|
8792a8 |
--- a/tc/m_police.c
|
|
|
8792a8 |
+++ b/tc/m_police.c
|
|
|
8792a8 |
@@ -278,7 +278,7 @@ static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
|
|
|
8792a8 |
__u64 rate64, prate64;
|
|
|
8792a8 |
__u64 pps64, ppsburst64;
|
|
|
8792a8 |
|
|
|
8792a8 |
- print_string(PRINT_ANY, "kind", "%s", "police");
|
|
|
8792a8 |
+ print_string(PRINT_JSON, "kind", "%s", "police");
|
|
|
8792a8 |
if (arg == NULL)
|
|
|
8792a8 |
return 0;
|
|
|
8792a8 |
|
|
|
8792a8 |
@@ -301,7 +301,8 @@ static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
|
|
|
8792a8 |
RTA_PAYLOAD(tb[TCA_POLICE_RATE64]) >= sizeof(rate64))
|
|
|
8792a8 |
rate64 = rta_getattr_u64(tb[TCA_POLICE_RATE64]);
|
|
|
8792a8 |
|
|
|
8792a8 |
- print_uint(PRINT_ANY, "index", "\t index %u ", p->index);
|
|
|
8792a8 |
+ print_hex(PRINT_FP, NULL, " police 0x%x ", p->index);
|
|
|
8792a8 |
+ print_uint(PRINT_JSON, "index", NULL, p->index);
|
|
|
8792a8 |
tc_print_rate(PRINT_FP, NULL, "rate %s ", rate64);
|
|
|
8792a8 |
buffer = tc_calc_xmitsize(rate64, p->burst);
|
|
|
8792a8 |
print_size(PRINT_FP, NULL, "burst %s ", buffer);
|
|
|
8792a8 |
@@ -342,12 +343,13 @@ static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
|
|
|
8792a8 |
print_string(PRINT_FP, NULL, " ", NULL);
|
|
|
8792a8 |
}
|
|
|
8792a8 |
|
|
|
8792a8 |
- print_uint(PRINT_ANY, "overhead", "overhead %u ", p->rate.overhead);
|
|
|
8792a8 |
+ print_size(PRINT_ANY, "overhead", "overhead %s ", p->rate.overhead);
|
|
|
8792a8 |
linklayer = (p->rate.linklayer & TC_LINKLAYER_MASK);
|
|
|
8792a8 |
if (linklayer > TC_LINKLAYER_ETHERNET || show_details)
|
|
|
8792a8 |
print_string(PRINT_ANY, "linklayer", "linklayer %s ",
|
|
|
8792a8 |
sprint_linklayer(linklayer, b2));
|
|
|
8792a8 |
- print_int(PRINT_ANY, "ref", "ref %d ", p->refcnt);
|
|
|
8792a8 |
+ print_nl();
|
|
|
8792a8 |
+ print_int(PRINT_ANY, "ref", "\tref %d ", p->refcnt);
|
|
|
8792a8 |
print_int(PRINT_ANY, "bind", "bind %d ", p->bindcnt);
|
|
|
8792a8 |
if (show_stats) {
|
|
|
8792a8 |
if (tb[TCA_POLICE_TM]) {
|
|
|
8792a8 |
--
|
|
|
8792a8 |
2.31.1
|
|
|
8792a8 |
|