* [PATCH iproute2 v2] police: Small corrections for the output
@ 2021-07-08 7:57 Roi Dayan
2021-07-12 12:30 ` Roi Dayan
0 siblings, 1 reply; 2+ messages in thread
From: Roi Dayan @ 2021-07-08 7:57 UTC (permalink / raw)
To: netdev
Cc: Roi Dayan, David Ahern, Hangbin Liu, Paul Blakey, Davide Caratti,
Jamal Hadi Salim, Roman Mashak, Baowen Zheng, Stephen Hemminger
Start a newline before printing the index and ref.
Print overhead with print_size().
Fixes: 0d5cf51e0d6c ("police: Add support for json output")
Signed-off-by: Roi Dayan <roid@nvidia.com>
---
Notes:
v2:
- add newline also before ref.
tc/m_police.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tc/m_police.c b/tc/m_police.c
index 2594c08979e0..d37f69b73e71 100644
--- a/tc/m_police.c
+++ b/tc/m_police.c
@@ -301,7 +301,8 @@ static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
RTA_PAYLOAD(tb[TCA_POLICE_RATE64]) >= sizeof(rate64))
rate64 = rta_getattr_u64(tb[TCA_POLICE_RATE64]);
- print_uint(PRINT_ANY, "index", "\t index %u ", p->index);
+ print_nl();
+ print_uint(PRINT_ANY, "index", "\tindex %u ", p->index);
tc_print_rate(PRINT_FP, NULL, "rate %s ", rate64);
buffer = tc_calc_xmitsize(rate64, p->burst);
print_size(PRINT_FP, NULL, "burst %s ", buffer);
@@ -342,12 +343,13 @@ static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
print_string(PRINT_FP, NULL, " ", NULL);
}
- print_uint(PRINT_ANY, "overhead", "overhead %u ", p->rate.overhead);
+ print_size(PRINT_ANY, "overhead", "overhead %s ", p->rate.overhead);
linklayer = (p->rate.linklayer & TC_LINKLAYER_MASK);
if (linklayer > TC_LINKLAYER_ETHERNET || show_details)
print_string(PRINT_ANY, "linklayer", "linklayer %s ",
sprint_linklayer(linklayer, b2));
- print_int(PRINT_ANY, "ref", "ref %d ", p->refcnt);
+ print_nl();
+ print_int(PRINT_ANY, "ref", "\tref %d ", p->refcnt);
print_int(PRINT_ANY, "bind", "bind %d ", p->bindcnt);
if (show_stats) {
if (tb[TCA_POLICE_TM]) {
--
2.8.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH iproute2 v2] police: Small corrections for the output
2021-07-08 7:57 [PATCH iproute2 v2] police: Small corrections for the output Roi Dayan
@ 2021-07-12 12:30 ` Roi Dayan
0 siblings, 0 replies; 2+ messages in thread
From: Roi Dayan @ 2021-07-12 12:30 UTC (permalink / raw)
To: netdev
Cc: David Ahern, Hangbin Liu, Paul Blakey, Davide Caratti,
Jamal Hadi Salim, Roman Mashak, Baowen Zheng, Stephen Hemminger
On 2021-07-08 10:57 AM, Roi Dayan wrote:
> Start a newline before printing the index and ref.
> Print overhead with print_size().
>
> Fixes: 0d5cf51e0d6c ("police: Add support for json output")
> Signed-off-by: Roi Dayan <roid@nvidia.com>
> ---
>
> Notes:
> v2:
> - add newline also before ref.
>
> tc/m_police.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/tc/m_police.c b/tc/m_police.c
> index 2594c08979e0..d37f69b73e71 100644
> --- a/tc/m_police.c
> +++ b/tc/m_police.c
> @@ -301,7 +301,8 @@ static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
> RTA_PAYLOAD(tb[TCA_POLICE_RATE64]) >= sizeof(rate64))
> rate64 = rta_getattr_u64(tb[TCA_POLICE_RATE64]);
>
> - print_uint(PRINT_ANY, "index", "\t index %u ", p->index);
> + print_nl();
> + print_uint(PRINT_ANY, "index", "\tindex %u ", p->index);
> tc_print_rate(PRINT_FP, NULL, "rate %s ", rate64);
> buffer = tc_calc_xmitsize(rate64, p->burst);
> print_size(PRINT_FP, NULL, "burst %s ", buffer);
> @@ -342,12 +343,13 @@ static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
> print_string(PRINT_FP, NULL, " ", NULL);
> }
>
> - print_uint(PRINT_ANY, "overhead", "overhead %u ", p->rate.overhead);
> + print_size(PRINT_ANY, "overhead", "overhead %s ", p->rate.overhead);
> linklayer = (p->rate.linklayer & TC_LINKLAYER_MASK);
> if (linklayer > TC_LINKLAYER_ETHERNET || show_details)
> print_string(PRINT_ANY, "linklayer", "linklayer %s ",
> sprint_linklayer(linklayer, b2));
> - print_int(PRINT_ANY, "ref", "ref %d ", p->refcnt);
> + print_nl();
> + print_int(PRINT_ANY, "ref", "\tref %d ", p->refcnt);
> print_int(PRINT_ANY, "bind", "bind %d ", p->bindcnt);
> if (show_stats) {
> if (tb[TCA_POLICE_TM]) {
>
this patch should be ignored now.
see "police: Fix normal output back to what it was"
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-12 12:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08 7:57 [PATCH iproute2 v2] police: Small corrections for the output Roi Dayan
2021-07-12 12:30 ` Roi Dayan
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).