[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6ntr2hx5dp4iq5slj76knjkne5ahkf3lhrwd7wus3p5mqjav6n@xwgnndoz4mzs>
Date: Mon, 26 Jun 2023 22:27:50 +0200
From: Zahari Doychev <zahari.doychev@...ux.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org, dsahern@...il.com, hmehrtens@...linear.com,
aleksander.lobakin@...el.com, simon.horman@...igine.com, idosch@...sch.org,
Zahari Doychev <zdoychev@...linear.com>
Subject: Re: [PATCH iproute2-next v2] f_flower: add cfm support
On Sun, Jun 25, 2023 at 12:03:41PM -0700, Stephen Hemminger wrote:
> On Tue, 20 Jun 2023 22:10:36 +0200
> Zahari Doychev <zahari.doychev@...ux.com> wrote:
>
> > + print_nl();
> > + print_string(PRINT_FP, NULL, " cfm", NULL);
> > + open_json_object("cfm");
> > +
> > + v = tb[TCA_FLOWER_KEY_CFM_MD_LEVEL];
> > + if (v) {
> > + sz += sprintf(out, " mdl %u", rta_getattr_u8(v));
> > + print_hhu(PRINT_JSON, "mdl", NULL, rta_getattr_u8(v));
> > +
> > + }
> > +
> > + v = tb[TCA_FLOWER_KEY_CFM_OPCODE];
> > + if (v) {
> > + sprintf(out + sz, " op %u", rta_getattr_u8(v));
> > + print_hhu(PRINT_JSON, "op", NULL, rta_getattr_u8(v));
> > +
> > + }
> > +
> > + close_json_object();
> > + print_string(PRINT_FP, "cfm", "%s", out);
>
> Don't think you need to format the temporary string if you do this the easy way.
> Just use print_uint?
> if (tb[TCA_FLOWER_KEY_CFM_MD_LEVEL])
> print_uint(PRINT_ANY, "mdl", " mdl %u",
> rta_getattr_u8(tb[TCA_FLOWER_KEY_CFM_MD_LEVEL]);
>
> Since argument to print_uint is unsigned, the u8 will naturally get expanded.
>
I think it will make it really simpler. I will try it out and send a new
patch as v3 was already merged.
Thanks
Zahari
Powered by blists - more mailing lists