Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH iproute2 1/1] police: Fix normal output back to what it was
@ 2021-07-12 12:26 Roi Dayan
  2021-07-12 13:07 ` Hangbin Liu
  2021-07-17 18:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Roi Dayan @ 2021-07-12 12:26 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

With the json support fix the normal output was
changed. set it back to what it was.
Print overhead with print_size().
Print newline before ref.

Fixes: 0d5cf51e0d6c ("police: Add support for json output")
Signed-off-by: Roi Dayan <roid@nvidia.com>
---
 tc/m_police.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tc/m_police.c b/tc/m_police.c
index 2594c08979e0..f38ab90a3039 100644
--- a/tc/m_police.c
+++ b/tc/m_police.c
@@ -278,7 +278,7 @@ static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
 	__u64 rate64, prate64;
 	__u64 pps64, ppsburst64;
 
-	print_string(PRINT_ANY, "kind", "%s", "police");
+	print_string(PRINT_JSON, "kind", "%s", "police");
 	if (arg == NULL)
 		return 0;
 
@@ -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_hex(PRINT_FP, NULL, " police 0x%x ", p->index);
+	print_uint(PRINT_JSON, "index", NULL, 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.26.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH iproute2 1/1] police: Fix normal output back to what it was
  2021-07-12 12:26 [PATCH iproute2 1/1] police: Fix normal output back to what it was Roi Dayan
@ 2021-07-12 13:07 ` Hangbin Liu
  2021-07-17 18:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Hangbin Liu @ 2021-07-12 13:07 UTC (permalink / raw)
  To: Roi Dayan
  Cc: netdev, David Ahern, Paul Blakey, Davide Caratti,
	Jamal Hadi Salim, Roman Mashak, Baowen Zheng, Stephen Hemminger

Hi Roi,

Thanks for the fix up.

Regards
Hangbin

On Mon, Jul 12, 2021 at 03:26:53PM +0300, Roi Dayan wrote:
> With the json support fix the normal output was
> changed. set it back to what it was.
> Print overhead with print_size().
> Print newline before ref.
> 
> Fixes: 0d5cf51e0d6c ("police: Add support for json output")
> Signed-off-by: Roi Dayan <roid@nvidia.com>
> ---
>  tc/m_police.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/tc/m_police.c b/tc/m_police.c
> index 2594c08979e0..f38ab90a3039 100644
> --- a/tc/m_police.c
> +++ b/tc/m_police.c
> @@ -278,7 +278,7 @@ static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
>  	__u64 rate64, prate64;
>  	__u64 pps64, ppsburst64;
>  
> -	print_string(PRINT_ANY, "kind", "%s", "police");
> +	print_string(PRINT_JSON, "kind", "%s", "police");
>  	if (arg == NULL)
>  		return 0;
>  
> @@ -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_hex(PRINT_FP, NULL, " police 0x%x ", p->index);
> +	print_uint(PRINT_JSON, "index", NULL, 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.26.2
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH iproute2 1/1] police: Fix normal output back to what it was
  2021-07-12 12:26 [PATCH iproute2 1/1] police: Fix normal output back to what it was Roi Dayan
  2021-07-12 13:07 ` Hangbin Liu
@ 2021-07-17 18:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-07-17 18:20 UTC (permalink / raw)
  To: Roi Dayan
  Cc: netdev, dsahern, liuhangbin, paulb, dcaratti, jhs, mrv,
	baowen.zheng, stephen

Hello:

This patch was applied to iproute2/iproute2.git (refs/heads/main):

On Mon, 12 Jul 2021 15:26:53 +0300 you wrote:
> With the json support fix the normal output was
> changed. set it back to what it was.
> Print overhead with print_size().
> Print newline before ref.
> 
> Fixes: 0d5cf51e0d6c ("police: Add support for json output")
> Signed-off-by: Roi Dayan <roid@nvidia.com>
> 
> [...]

Here is the summary with links:
  - [iproute2,1/1] police: Fix normal output back to what it was
    https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=71d36000dc9c

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] 3+ messages in thread

end of thread, other threads:[~2021-07-17 18:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12 12:26 [PATCH iproute2 1/1] police: Fix normal output back to what it was Roi Dayan
2021-07-12 13:07 ` Hangbin Liu
2021-07-17 18:20 ` 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).