netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2-next 1/1] tc: add json support in csum action
@ 2018-06-05 19:30 Keara Leibovitz
  2018-06-05 19:56 ` David Ahern
  0 siblings, 1 reply; 2+ messages in thread
From: Keara Leibovitz @ 2018-06-05 19:30 UTC (permalink / raw)
  To: dsahern; +Cc: stephen, netdev, kernel, Keara Leibovitz

Signed-off-by: Keara Leibovitz <kleib@mojatatu.com>
---
 tc/m_csum.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/tc/m_csum.c b/tc/m_csum.c
index 8391071d73f2..67481667d9d2 100644
--- a/tc/m_csum.c
+++ b/tc/m_csum.c
@@ -162,6 +162,7 @@ print_csum(struct action_util *au, FILE *f, struct rtattr *arg)
 	char *uflag_5 = "";
 	char *uflag_6 = "";
 	char *uflag_7 = "";
+	char buf[64] = {0};
 
 	int uflag_count = 0;
 
@@ -198,12 +199,15 @@ print_csum(struct action_util *au, FILE *f, struct rtattr *arg)
 		uflag_1 = "?empty";
 	}
 
-	fprintf(f, "csum (%s%s%s%s%s%s%s) ",
-		uflag_1, uflag_2, uflag_3,
-		uflag_4, uflag_5, uflag_6, uflag_7);
+	snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s",
+		 uflag_1, uflag_2, uflag_3,
+		 uflag_4, uflag_5, uflag_6, uflag_7);
+	print_string(PRINT_ANY, "csum", "csum (%s) ", buf);
+
 	print_action_control(f, "action ", sel->action, "\n");
-	fprintf(f, "\tindex %u ref %d bind %d", sel->index, sel->refcnt,
-		sel->bindcnt);
+	print_uint(PRINT_ANY, "index", "\tindex %u", sel->index);
+	print_int(PRINT_ANY, "ref", " ref %d", sel->refcnt);
+	print_int(PRINT_ANY, "bind", " bind %d", sel->bindcnt);
 
 	if (show_stats) {
 		if (tb[TCA_CSUM_TM]) {
@@ -212,7 +216,7 @@ print_csum(struct action_util *au, FILE *f, struct rtattr *arg)
 			print_tm(f, tm);
 		}
 	}
-	fprintf(f, "\n");
+	print_string(PRINT_FP, NULL, "%s", "\n");
 
 	return 0;
 }
-- 
2.7.4

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

* Re: [PATCH iproute2-next 1/1] tc: add json support in csum action
  2018-06-05 19:30 [PATCH iproute2-next 1/1] tc: add json support in csum action Keara Leibovitz
@ 2018-06-05 19:56 ` David Ahern
  0 siblings, 0 replies; 2+ messages in thread
From: David Ahern @ 2018-06-05 19:56 UTC (permalink / raw)
  To: Keara Leibovitz, dsahern; +Cc: stephen, netdev, kernel

On 6/5/18 12:30 PM, Keara Leibovitz wrote:

please add some words here. e.g., add example output

> Signed-off-by: Keara Leibovitz <kleib@mojatatu.com>
> ---
>  tc/m_csum.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/tc/m_csum.c b/tc/m_csum.c
> index 8391071d73f2..67481667d9d2 100644
> --- a/tc/m_csum.c
> +++ b/tc/m_csum.c
> @@ -162,6 +162,7 @@ print_csum(struct action_util *au, FILE *f, struct rtattr *arg)
>  	char *uflag_5 = "";
>  	char *uflag_6 = "";
>  	char *uflag_7 = "";
> +	char buf[64] = {0};

initialization is not needed. It is set before use.

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

end of thread, other threads:[~2018-06-05 19:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-05 19:30 [PATCH iproute2-next 1/1] tc: add json support in csum action Keara Leibovitz
2018-06-05 19:56 ` David Ahern

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