netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: Roi Dayan <roid@nvidia.com>
Cc: netdev@vger.kernel.org, Paul Blakey <paulb@nvidia.com>,
	David Ahern <dsahern@gmail.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	Roman Mashak <mrv@mojatatu.com>,
	Davide Caratti <dcaratti@redhat.com>,
	Baowen Zheng <baowen.zheng@corigine.com>
Subject: Re: [PATCH iproute2-next v4 1/1] police: Add support for json output
Date: Mon, 5 Jul 2021 18:41:37 +0800	[thread overview]
Message-ID: <YOLh4U4JM7lcursX@fedora> (raw)
In-Reply-To: <20210607064408.1668142-1-roid@nvidia.com>

On Mon, Jun 07, 2021 at 09:44:08AM +0300, Roi Dayan wrote:
> Change to use the print wrappers instead of fprintf().
> 
> This is example output of the options part before this commit:
> 
>         "options": {
>             "handle": 1,
>             "in_hw": true,
>             "actions": [ {
>                     "order": 1 police 0x2 ,
>                     "control_action": {
>                         "type": "drop"
>                     },
>                     "control_action": {
>                         "type": "continue"
>                     }overhead 0b linklayer unspec
>         ref 1 bind 1
> ,
>                     "used_hw_stats": [ "delayed" ]
>                 } ]
>         }
> 
> This is the output of the same dump with this commit:
> 
>         "options": {
>             "handle": 1,
>             "in_hw": true,
>             "actions": [ {
>                     "order": 1,
>                     "kind": "police",
>                     "index": 2,
>                     "control_action": {
>                         "type": "drop"
>                     },
>                     "control_action": {
>                         "type": "continue"
>                     },
>                     "overhead": 0,
>                     "linklayer": "unspec",
>                     "ref": 1,
>                     "bind": 1,
>                     "used_hw_stats": [ "delayed" ]
>                 } ]
>         }
> 
> Signed-off-by: Roi Dayan <roid@nvidia.com>
> Reviewed-by: Paul Blakey <paulb@nvidia.com>
> ---

[...]
> 
> @@ -300,13 +301,13 @@ 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]);
>  
> -	fprintf(f, " police 0x%x ", p->index);
> +	print_uint(PRINT_ANY, "index", "\t index %u ", p->index);

Hi everyone,

This update break all policy checking in kernel tc selftest actions/police.json.
As the new output would like 

total acts 1

        action order 0: police   index 1 rate 1Kbit burst 10Kb mtu 2Kb action reclassify overhead 0 ref 1 bind 0


And the current test checks like

	"matchPattern": "action order [0-9]*:  police 0x1 rate 1Kbit burst 10Kb"

I plan to update the kselftest to mach the new output. But I have a question.
Why need we add a "\t" before index output? Is it needed or could be removed?

Thanks
Hangbin

  parent reply	other threads:[~2021-07-05 10:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07  6:44 [PATCH iproute2-next v4 1/1] police: Add support for json output Roi Dayan
2021-06-11  2:35 ` David Ahern
2021-07-05 10:41 ` Hangbin Liu [this message]
2021-07-06  8:27   ` Davide Caratti
2021-07-07  6:53     ` Hangbin Liu
2021-07-08  6:57       ` Roi Dayan
2021-07-08  7:23         ` Roi Dayan
2021-07-08 14:46         ` David Ahern
2021-07-11 10:24           ` Roi Dayan
2021-07-11 16:00             ` David Ahern
2021-07-12 11:02               ` Jamal Hadi Salim
2021-07-12 12:28                 ` Roi Dayan
2021-07-05 16:28 ` Stephen Hemminger
2021-07-05 16:30   ` David Ahern
2021-07-06  8:30     ` Roi Dayan
2021-07-06  8:36       ` Roi Dayan
2021-07-05 16:29 ` Stephen Hemminger

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=YOLh4U4JM7lcursX@fedora \
    --to=liuhangbin@gmail.com \
    --cc=baowen.zheng@corigine.com \
    --cc=dcaratti@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=jhs@mojatatu.com \
    --cc=mrv@mojatatu.com \
    --cc=netdev@vger.kernel.org \
    --cc=paulb@nvidia.com \
    --cc=roid@nvidia.com \
    --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;
as well as URLs for NNTP newsgroup(s).