netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch iproute2 0/2] tc: couple ouf action cookie printout fixes
@ 2017-11-25 10:07 Jiri Pirko
  2017-11-25 10:07 ` [patch iproute2 1/2] tc: move action cookie print out of the stats if Jiri Pirko
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jiri Pirko @ 2017-11-25 10:07 UTC (permalink / raw)
  To: netdev; +Cc: stephen, jhs, mlxsw

From: Jiri Pirko <jiri@mellanox.com>

Jiri Pirko (2):
  tc: move action cookie print out of the stats if
  tc: remove action cookie len from printout

 tc/m_action.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

-- 
2.9.5

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

* [patch iproute2 1/2] tc: move action cookie print out of the stats if
  2017-11-25 10:07 [patch iproute2 0/2] tc: couple ouf action cookie printout fixes Jiri Pirko
@ 2017-11-25 10:07 ` Jiri Pirko
  2017-11-25 10:07 ` [patch iproute2 2/2] tc: remove action cookie len from printout Jiri Pirko
  2017-11-26 20:19 ` [patch iproute2 0/2] tc: couple ouf action cookie printout fixes Stephen Hemminger
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Pirko @ 2017-11-25 10:07 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 85f9e27..aa3aa52 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] 4+ messages in thread

* [patch iproute2 2/2] tc: remove action cookie len from printout
  2017-11-25 10:07 [patch iproute2 0/2] tc: couple ouf action cookie printout fixes Jiri Pirko
  2017-11-25 10:07 ` [patch iproute2 1/2] tc: move action cookie print out of the stats if Jiri Pirko
@ 2017-11-25 10:07 ` Jiri Pirko
  2017-11-26 20:19 ` [patch iproute2 0/2] tc: couple ouf action cookie printout fixes Stephen Hemminger
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Pirko @ 2017-11-25 10:07 UTC (permalink / raw)
  To: netdev; +Cc: stephen, jhs, mlxsw

From: Jiri Pirko <jiri@mellanox.com>

Make the output same as input and avoid printout of unnecessary len.

Suggested-by: Stephen Hemminger <stephen@networkplumber.org>
Fixes: fd8b3d2c1b9b ("actions: Add support for user cookies")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 tc/m_action.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tc/m_action.c b/tc/m_action.c
index aa3aa52..e6d9149 100644
--- a/tc/m_action.c
+++ b/tc/m_action.c
@@ -309,7 +309,7 @@ static int tc_print_one_action(FILE *f, struct rtattr *arg)
 		int strsz = RTA_PAYLOAD(tb[TCA_ACT_COOKIE]);
 		char b1[strsz * 2 + 1];
 
-		fprintf(f, "\tcookie len %d %s\n", strsz,
+		fprintf(f, "\tcookie %s\n",
 			hexstring_n2a(RTA_DATA(tb[TCA_ACT_COOKIE]),
 				      strsz, b1, sizeof(b1)));
 	}
-- 
2.9.5

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

* Re: [patch iproute2 0/2] tc: couple ouf action cookie printout fixes
  2017-11-25 10:07 [patch iproute2 0/2] tc: couple ouf action cookie printout fixes Jiri Pirko
  2017-11-25 10:07 ` [patch iproute2 1/2] tc: move action cookie print out of the stats if Jiri Pirko
  2017-11-25 10:07 ` [patch iproute2 2/2] tc: remove action cookie len from printout Jiri Pirko
@ 2017-11-26 20:19 ` Stephen Hemminger
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2017-11-26 20:19 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, jhs, mlxsw

On Sat, 25 Nov 2017 11:07:55 +0100
Jiri Pirko <jiri@resnulli.us> wrote:

> From: Jiri Pirko <jiri@mellanox.com>
> 
> Jiri Pirko (2):
>   tc: move action cookie print out of the stats if
>   tc: remove action cookie len from printout
> 
>  tc/m_action.c | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 

Applied,  thanks Jiri

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

end of thread, other threads:[~2017-11-26 20:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-25 10:07 [patch iproute2 0/2] tc: couple ouf action cookie printout fixes Jiri Pirko
2017-11-25 10:07 ` [patch iproute2 1/2] tc: move action cookie print out of the stats if Jiri Pirko
2017-11-25 10:07 ` [patch iproute2 2/2] tc: remove action cookie len from printout Jiri Pirko
2017-11-26 20:19 ` [patch iproute2 0/2] tc: couple ouf action cookie printout fixes Stephen Hemminger

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).