[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221222180219.22b109c5@kernel.org>
Date: Thu, 22 Dec 2022 18:02:19 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: "Mogilappagari, Sudheer" <sudheer.mogilappagari@...el.com>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"mkubecek@...e.cz" <mkubecek@...e.cz>,
"andrew@...n.ch" <andrew@...n.ch>,
"corbet@....net" <corbet@....net>,
"Samudrala, Sridhar" <sridhar.samudrala@...el.com>,
"Nguyen, Anthony L" <anthony.l.nguyen@...el.com>
Subject: Re: [PATCH ethtool-next v2 2/2] netlink: add netlink handler for
get rss (-x)
On Thu, 22 Dec 2022 22:57:19 +0000 Mogilappagari, Sudheer wrote:
> Will use "RSS hash-key' as key name and array.
rss-hash-key ?
> Output in hex bytes like [ be,c3,13,... ] will be better
> I fell but it needs below changes. Without below changes
> output looks ["be", "c3", "13"...]. Will send out
> v3 (with below changes as additional patch) unless there
> is an objection.
Hex would be great, but AFAIR JSON does not support hex :(
Imagine dealing with this in python, or bash. Do you really
want the values to be strings? They will have to get converted
manually to integers. So I think just making them integers is
best, JSON is for machines not for looking at...
> +++ b/json_print.c
> void print_hex(enum output_type type, unsigned int hex)
> {
> if (_IS_JSON_CONTEXT(type)) {
> - SPRINT_BUF(b1);
> - snprintf(b1, sizeof(b1), "%x", hex);
> if (key)
> - jsonw_string_field(_jw, key, b1);
> + jsonw_xint_field(_jw, key, hex);
> else
> - jsonw_string(_jw, b1);
> + jsonw_xint(_jw, hex);
> } else if (_IS_FP_CONTEXT(type)) {
> fprintf(stdout, fmt, hex);
> }
Powered by blists - more mailing lists