netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: "Mogilappagari, Sudheer" <sudheer.mogilappagari@intel.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"mkubecek@suse.cz" <mkubecek@suse.cz>,
	"andrew@lunn.ch" <andrew@lunn.ch>,
	"corbet@lwn.net" <corbet@lwn.net>,
	"Samudrala, Sridhar" <sridhar.samudrala@intel.com>,
	"Nguyen, Anthony L" <anthony.l.nguyen@intel.com>
Subject: Re: [PATCH ethtool-next v2 2/2] netlink: add netlink handler for get rss (-x)
Date: Thu, 22 Dec 2022 18:02:19 -0800	[thread overview]
Message-ID: <20221222180219.22b109c5@kernel.org> (raw)
In-Reply-To: <IA1PR11MB6266430ED759770807768D4EE4E89@IA1PR11MB6266.namprd11.prod.outlook.com>

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);
>         }

  reply	other threads:[~2022-12-23  2:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-22  0:13 [PATCH ethtool-next v2 0/2] add netlink support for rss get Sudheer Mogilappagari
2022-12-22  0:13 ` [PATCH ethtool-next v2 1/2] Move code that print rss info into common file Sudheer Mogilappagari
2022-12-22  0:13 ` [PATCH ethtool-next v2 2/2] netlink: add netlink handler for get rss (-x) Sudheer Mogilappagari
2022-12-22  1:22   ` Jakub Kicinski
2022-12-22 22:57     ` Mogilappagari, Sudheer
2022-12-23  2:02       ` Jakub Kicinski [this message]
2022-12-23 11:08         ` Francois Romieu
2022-12-23 19:50           ` Jakub Kicinski
2022-12-25 18:07             ` Francois Romieu

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=20221222180219.22b109c5@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=corbet@lwn.net \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=sridhar.samudrala@intel.com \
    --cc=sudheer.mogilappagari@intel.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).