public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Petr Machata <petrm@nvidia•com>
To: <Daniel.Machon@microchip•com>
Cc: <stephen@networkplumber•org>, <netdev@vger•kernel.org>,
	<dsahern@kernel•org>, <petrm@nvidia•com>,
	<maxime.chevallier@bootlin•com>, <vladimir.oltean@nxp•com>,
	<UNGLinuxDriver@microchip•com>
Subject: Re: [PATCH iproute2-next v3 1/2] dcb: add new pcp-prio parameter to dcb app
Date: Tue, 6 Dec 2022 09:55:33 +0100	[thread overview]
Message-ID: <875yeoewch.fsf@nvidia.com> (raw)
In-Reply-To: <Y45G/t9V3luxRDGF@DEN-LT-70577>


<Daniel.Machon@microchip•com> writes:

>> On Mon, 5 Dec 2022 09:19:06 +0000
>> <Daniel.Machon@microchip•com> wrote:
>> 
>> > > > Trying to understand your comment.
>> > > >
>> > > > Are you talking about not producing any JSON output with the symbolic
>> > > > PCP values? eg. ["1de", 1] -> [8, 1]. So basically print with PRINT_FP
>> > > > in case of printing in JSON context?
>> > >
>> > > What does output look like in json and non-json versions?
>> >
>> > non-JSON: pcp-prio 1de:1
>> > JSON    : {"pcp_prio":[["1de",1]]}
>> 
>> Would the JSON be better as:
>>         { "pcp_prio" :[ { "1de":1 } ] }
>> 
>> It looks like the PCP values are both unique and used in a name/value manner.
>
> In this case I think it would be best to stay consistent with the rest
> of the dcb app code. All priority mappings are printed using the
> dcb_app_print_filtered() (now also the pcp-prio), which creates an
> array, for whatever reason.

The reason is that APP mappings are not unique. It is OK to have rules
for both 1de:1 and 1de:2. And 2de:1 and 2de:2 too, it's a full m:n
relationship. A JSON dictionary would not work well for this purpose.
(It's not technically forbidden to have duplicate keys in a JSON
dictionary, just discouraged, i.e. SHOULD NOT rather than SHALL NOT, but
e.g. jq then doesn't let you work with both entries.)

  parent reply	other threads:[~2022-12-06  9:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-02  9:22 [PATCH iproute2-next v3 0/2] Add pcp-prio and new apptrust subcommand Daniel Machon
2022-12-02  9:22 ` [PATCH iproute2-next v3 1/2] dcb: add new pcp-prio parameter to dcb app Daniel Machon
2022-12-03 17:00   ` Stephen Hemminger
2022-12-04 22:27     ` Daniel.Machon
2022-12-05  1:52       ` Stephen Hemminger
2022-12-05  9:19         ` Daniel.Machon
2022-12-05 16:23           ` Stephen Hemminger
2022-12-05 19:19             ` Daniel.Machon
2022-12-05 21:05               ` Stephen Hemminger
2022-12-06  8:55               ` Petr Machata [this message]
2022-12-02  9:22 ` [PATCH iproute2-next v3 2/2] dcb: add new subcommand for apptrust Daniel Machon

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=875yeoewch.fsf@nvidia.com \
    --to=petrm@nvidia$(echo .)com \
    --cc=Daniel.Machon@microchip$(echo .)com \
    --cc=UNGLinuxDriver@microchip$(echo .)com \
    --cc=dsahern@kernel$(echo .)org \
    --cc=maxime.chevallier@bootlin$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=stephen@networkplumber$(echo .)org \
    --cc=vladimir.oltean@nxp$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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