netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Xin Long <lucien.xin@gmail.com>
Cc: network dev <netdev@vger.kernel.org>,
	Simon Horman <simon.horman@netronome.com>,
	David Ahern <dsahern@gmail.com>
Subject: Re: [PATCHv3 iproute2-next 3/7] iproute_lwtunnel: add options support for erspan metadata
Date: Thu, 23 Apr 2020 08:23:51 -0700	[thread overview]
Message-ID: <20200423082351.5cd10f4d@hermes.lan> (raw)
In-Reply-To: <CADvbK_dYwQ6LTuNPfGjdZPkFbrV2_vrX7OL7q3oR9830Mb8NcQ@mail.gmail.com>

On Sat, 15 Feb 2020 01:40:27 +0800
Xin Long <lucien.xin@gmail.com> wrote:

> On Sat, Feb 15, 2020 at 12:13 AM Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> >
> > On Fri, 14 Feb 2020 18:30:47 +0800
> > Xin Long <lucien.xin@gmail.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

There are several different requests.

 1. The format of the output must match the input.
 2. Printing values in hex would be nice if they are bit fields
 3. If non json uses hex, then json should use hex
    json is type less so { "ver":2 } and { "ver":"0x2" } are the same



  parent reply	other threads:[~2020-04-23 15:24 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14 10:30 [PATCHv3 iproute2-next 0/7] iproute2: fully support for geneve/vxlan/erspan options Xin Long
2020-02-14 10:30 ` [PATCHv3 iproute2-next 1/7] iproute_lwtunnel: add options support for geneve metadata Xin Long
2020-02-14 10:30   ` [PATCHv3 iproute2-next 2/7] iproute_lwtunnel: add options support for vxlan metadata Xin Long
2020-02-14 10:30     ` [PATCHv3 iproute2-next 3/7] iproute_lwtunnel: add options support for erspan metadata Xin Long
2020-02-14 10:30       ` [PATCHv3 iproute2-next 4/7] tc: m_tunnel_key: add options support for vxlan Xin Long
2020-02-14 10:30         ` [PATCHv3 iproute2-next 5/7] tc: m_tunnel_key: add options support for erpsan Xin Long
2020-02-14 10:30           ` [PATCHv3 iproute2-next 6/7] tc: f_flower: add options support for vxlan Xin Long
2020-02-14 10:30             ` [PATCHv3 iproute2-next 7/7] tc: f_flower: add options support for erspan Xin Long
2020-02-14 16:13       ` [PATCHv3 iproute2-next 3/7] iproute_lwtunnel: add options support for erspan metadata Stephen Hemminger
2020-02-14 17:40         ` Xin Long
2020-02-15  0:21           ` Stephen Hemminger
2020-02-15  4:18             ` Xin Long
2020-02-15 16:51               ` David Ahern
2020-02-16  6:38                 ` Xin Long
2020-02-17 19:53                   ` David Ahern
2020-02-17 21:02                     ` Stephen Hemminger
2020-02-18  4:29                       ` Xin Long
2020-04-19  8:39                         ` Xin Long
2020-04-19 22:28                           ` David Ahern
2020-04-23 11:06                             ` Xin Long
2020-04-26 18:29                             ` David Ahern
2020-04-27  5:51                               ` Xin Long
2020-04-23 15:23           ` Stephen Hemminger [this message]
2020-04-23 18:03             ` Jakub Kicinski
2020-04-27 12:38               ` David Ahern
2020-04-27 23:07                 ` Stephen Hemminger
2020-04-28  7:22             ` Xin Long

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200423082351.5cd10f4d@hermes.lan \
    --to=stephen@networkplumber.org \
    --cc=dsahern@gmail.com \
    --cc=lucien.xin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=simon.horman@netronome.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).