* [patch iproute2] tc: move action cookie print out of the stats if
@ 2017-11-24 8:28 Jiri Pirko
2017-11-24 17:11 ` Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Pirko @ 2017-11-24 8:28 UTC (permalink / raw)
To: netdev; +Cc: stephen, jhs, mlxsw
From: Jiri Pirko <jiri@mellanox.com>
Cookie print was made dependent on show_stats for no good reason. Fix
this bu pushing cookie print ot of the stats if.
Fixes: fd8b3d2c1b9b ("actions: Add support for user cookies")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
tc/m_action.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/tc/m_action.c b/tc/m_action.c
index 0dce97f..c2fc4f1 100644
--- a/tc/m_action.c
+++ b/tc/m_action.c
@@ -301,19 +301,18 @@ static int tc_print_one_action(FILE *f, struct rtattr *arg)
return err;
if (show_stats && tb[TCA_ACT_STATS]) {
-
fprintf(f, "\tAction statistics:\n");
print_tcstats2_attr(f, tb[TCA_ACT_STATS], "\t", NULL);
- if (tb[TCA_ACT_COOKIE]) {
- int strsz = RTA_PAYLOAD(tb[TCA_ACT_COOKIE]);
- char b1[strsz * 2 + 1];
-
- fprintf(f, "\n\tcookie len %d %s ", strsz,
- hexstring_n2a(RTA_DATA(tb[TCA_ACT_COOKIE]),
- strsz, b1, sizeof(b1)));
- }
fprintf(f, "\n");
}
+ if (tb[TCA_ACT_COOKIE]) {
+ int strsz = RTA_PAYLOAD(tb[TCA_ACT_COOKIE]);
+ char b1[strsz * 2 + 1];
+
+ fprintf(f, "\tcookie len %d %s\n", strsz,
+ hexstring_n2a(RTA_DATA(tb[TCA_ACT_COOKIE]),
+ strsz, b1, sizeof(b1)));
+ }
return 0;
}
--
2.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch iproute2] tc: move action cookie print out of the stats if
2017-11-24 8:28 [patch iproute2] tc: move action cookie print out of the stats if Jiri Pirko
@ 2017-11-24 17:11 ` Stephen Hemminger
2017-11-25 8:35 ` Jiri Pirko
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2017-11-24 17:11 UTC (permalink / raw)
To: Jiri Pirko; +Cc: netdev, jhs, mlxsw
On Fri, 24 Nov 2017 09:28:21 +0100
Jiri Pirko <jiri@resnulli.us> wrote:
> From: Jiri Pirko <jiri@mellanox.com>
>
> Cookie print was made dependent on show_stats for no good reason. Fix
> this bu pushing cookie print ot of the stats if.
>
> Fixes: fd8b3d2c1b9b ("actions: Add support for user cookies")
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> ---
> tc/m_action.c | 17 ++++++++---------
> 1 file changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/tc/m_action.c b/tc/m_action.c
> index 0dce97f..c2fc4f1 100644
> --- a/tc/m_action.c
> +++ b/tc/m_action.c
> @@ -301,19 +301,18 @@ static int tc_print_one_action(FILE *f, struct rtattr *arg)
> return err;
>
> if (show_stats && tb[TCA_ACT_STATS]) {
> -
> fprintf(f, "\tAction statistics:\n");
> print_tcstats2_attr(f, tb[TCA_ACT_STATS], "\t", NULL);
> - if (tb[TCA_ACT_COOKIE]) {
> - int strsz = RTA_PAYLOAD(tb[TCA_ACT_COOKIE]);
> - char b1[strsz * 2 + 1];
> -
> - fprintf(f, "\n\tcookie len %d %s ", strsz,
> - hexstring_n2a(RTA_DATA(tb[TCA_ACT_COOKIE]),
> - strsz, b1, sizeof(b1)));
> - }
> fprintf(f, "\n");
> }
> + if (tb[TCA_ACT_COOKIE]) {
> + int strsz = RTA_PAYLOAD(tb[TCA_ACT_COOKIE]);
> + char b1[strsz * 2 + 1];
> +
> + fprintf(f, "\tcookie len %d %s\n", strsz,
> + hexstring_n2a(RTA_DATA(tb[TCA_ACT_COOKIE]),
> + strsz, b1, sizeof(b1)));
> + }
>
> return 0;
> }
Yes, it should not be under stats flag.
The general model is that -s is for statistics only; and -d is for read only detail values.
So this makes sense.
The problem is that the format of the action cookie needs to be same on command line
argument and on display; i.e drop the length part of the display .
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch iproute2] tc: move action cookie print out of the stats if
2017-11-24 17:11 ` Stephen Hemminger
@ 2017-11-25 8:35 ` Jiri Pirko
0 siblings, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2017-11-25 8:35 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev, jhs, mlxsw
Fri, Nov 24, 2017 at 06:11:42PM CET, stephen@networkplumber.org wrote:
>On Fri, 24 Nov 2017 09:28:21 +0100
>Jiri Pirko <jiri@resnulli.us> wrote:
>
>> From: Jiri Pirko <jiri@mellanox.com>
>>
>> Cookie print was made dependent on show_stats for no good reason. Fix
>> this bu pushing cookie print ot of the stats if.
>>
>> Fixes: fd8b3d2c1b9b ("actions: Add support for user cookies")
>> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
>> ---
>> tc/m_action.c | 17 ++++++++---------
>> 1 file changed, 8 insertions(+), 9 deletions(-)
>>
>> diff --git a/tc/m_action.c b/tc/m_action.c
>> index 0dce97f..c2fc4f1 100644
>> --- a/tc/m_action.c
>> +++ b/tc/m_action.c
>> @@ -301,19 +301,18 @@ static int tc_print_one_action(FILE *f, struct rtattr *arg)
>> return err;
>>
>> if (show_stats && tb[TCA_ACT_STATS]) {
>> -
>> fprintf(f, "\tAction statistics:\n");
>> print_tcstats2_attr(f, tb[TCA_ACT_STATS], "\t", NULL);
>> - if (tb[TCA_ACT_COOKIE]) {
>> - int strsz = RTA_PAYLOAD(tb[TCA_ACT_COOKIE]);
>> - char b1[strsz * 2 + 1];
>> -
>> - fprintf(f, "\n\tcookie len %d %s ", strsz,
>> - hexstring_n2a(RTA_DATA(tb[TCA_ACT_COOKIE]),
>> - strsz, b1, sizeof(b1)));
>> - }
>> fprintf(f, "\n");
>> }
>> + if (tb[TCA_ACT_COOKIE]) {
>> + int strsz = RTA_PAYLOAD(tb[TCA_ACT_COOKIE]);
>> + char b1[strsz * 2 + 1];
>> +
>> + fprintf(f, "\tcookie len %d %s\n", strsz,
>> + hexstring_n2a(RTA_DATA(tb[TCA_ACT_COOKIE]),
>> + strsz, b1, sizeof(b1)));
>> + }
>>
>> return 0;
>> }
>
>Yes, it should not be under stats flag.
>The general model is that -s is for statistics only; and -d is for read only detail values.
>So this makes sense.
>
>The problem is that the format of the action cookie needs to be same on command line
>argument and on display; i.e drop the length part of the display .
I agree. But that should be a separate patch.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-11-25 8:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-24 8:28 [patch iproute2] tc: move action cookie print out of the stats if Jiri Pirko
2017-11-24 17:11 ` Stephen Hemminger
2017-11-25 8:35 ` Jiri Pirko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.