[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADvbK_dYwQ6LTuNPfGjdZPkFbrV2_vrX7OL7q3oR9830Mb8NcQ@mail.gmail.com>
Date: Sat, 15 Feb 2020 01:40:27 +0800
From: Xin Long <lucien.xin@...il.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: network dev <netdev@...r.kernel.org>,
Simon Horman <simon.horman@...ronome.com>,
David Ahern <dsahern@...il.com>
Subject: Re: [PATCHv3 iproute2-next 3/7] iproute_lwtunnel: add options support
for erspan metadata
On Sat, Feb 15, 2020 at 12:13 AM Stephen Hemminger
<stephen@...workplumber.org> wrote:
>
> On Fri, 14 Feb 2020 18:30:47 +0800
> Xin Long <lucien.xin@...il.com> wrote:
>
> > +
> > + open_json_array(PRINT_JSON, name);
> > + open_json_object(NULL);
> > + print_uint(PRINT_JSON, "ver", NULL, ver);
> > + print_uint(PRINT_JSON, "index", NULL, idx);
> > + print_uint(PRINT_JSON, "dir", NULL, dir);
> > + print_uint(PRINT_JSON, "hwid", NULL, hwid);
> > + close_json_object();
> > + close_json_array(PRINT_JSON, name);
> > +
> > + print_nl();
> > + print_string(PRINT_FP, name, "\t%s ", name);
> > + sprintf(strbuf, "%02x:%08x:%02x:%02x", ver, idx, dir, hwid);
> > + print_string(PRINT_FP, NULL, "%s ", strbuf);
> > +}
>
> Instead of having two sets of prints, is it possible to do this
> print_nl();
> print_string(PRINT_FP, NULL, "\t", NULL);
>
> open_json_array(PRINT_ANY, name);
> open_json_object(NULL);
> print_0xhex(PRINT_ANY, "ver", " %02x", ver);
> print_0xhex(PRINT_ANY, "idx", ":%08x", idx);
> print_0xhex(PRINT_ANY, "dir", ":%02x", dir);
> print_0xhex(PRINT_ANY, "hwid", ":%02x", hwid)
> close_json_object();
> close_json_array(PRINT_ANY, " ");
Hi Stephen,
This's not gonna work. as the output will be:
{"ver":"0x2","idx":"0","dir":"0x1","hwid":"0x2"} (string)
instead of
{"ver":2,"index":0,"dir":1,"hwid":2} (number)
>
> Also, you seem to not hear the request to not use opaque hex values
> in the iproute2 interface. The version, index, etc should be distinct
> parameter values not a hex string.
The opts STRING, especially these like "XX:YY:ZZ" are represented
as hex string on both adding and dumping. It is to keep consistent with
geneve_opts in m_tunnel_key and f_flower, see
commit 6217917a382682d8e8a7ecdeb0c6626f701a0933
Author: Simon Horman <simon.horman@...ronome.com>
Date: Thu Jul 5 17:12:00 2018 -0700
tc: m_tunnel_key: Add tunnel option support to act_tunnel_key
and
commit 56155d4df86d489c4207444c8a90ce4e0e22e49f
Author: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@...ronome.com>
Date: Fri Sep 28 16:03:39 2018 +0200
tc: f_flower: add geneve option match support to flower
and actually, the code type I'm using is exactly from these 2 patches.
please take a look.
I don't think this patchset should go to another type of format for opts.
Thanks.
>
> I think this still needs more work before merging.
Powered by blists - more mailing lists