All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Machata <petrm@nvidia.com>
To: Ioana Ciornei <ioana.ciornei@nxp.com>
Cc: Petr Machata <petrm@nvidia.com>, <netdev@vger.kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S.  Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>, Shuah Khan <shuah@kernel.org>,
	Simon Horman <horms@kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH net-next 4/5] selftests: forwarding: extend ethtool_std_stats_get with pause statistics
Date: Tue, 3 Mar 2026 14:06:29 +0100	[thread overview]
Message-ID: <87342hf3h7.fsf@nvidia.com> (raw)
In-Reply-To: <ffbxeysgshogwmtraatgh6vtrwo742fpzbgaiyjnmqwxxbzzua@mhsfkhmuiu45>


Ioana Ciornei <ioana.ciornei@nxp.com> writes:

> On Fri, Feb 27, 2026 at 05:38:40PM +0100, Petr Machata wrote:
>> 
>> Ioana Ciornei <ioana.ciornei@nxp.com> writes:
>> 
>> > Even though pause frame statistics are not exported through the same
>> > ethtool command, there is no point in adding another helper just for
>> > them. Extent the ethtool_std_stats_get() function so that we are able to
>> > interrogate using the same helper all the standard statistics.
>> >
>> > Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
>> > ---
>> >  tools/testing/selftests/net/forwarding/lib.sh | 8 ++++++--
>> >  1 file changed, 6 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
>> > index a9034f0bb58b..efd236ae1c28 100644
>> > --- a/tools/testing/selftests/net/forwarding/lib.sh
>> > +++ b/tools/testing/selftests/net/forwarding/lib.sh
>> > @@ -831,8 +831,12 @@ ethtool_std_stats_get()
>> >  	local name=$1; shift
>> >  	local src=$1; shift
>> >  
>> > -	ethtool --json -S $dev --groups $grp -- --src $src | \
>> > -		jq '.[]."'"$grp"'"."'$name'"'
>> > +	if [[ "$grp" == "pause" ]]; then
>> > +		ethtool -I --json -a $dev | jq '.[].statistics.'$name
>> 
>> I think name needs to be quoted here? In fact, unless the pause group is
>> highly unlikely to ever get a key that contains a dash,
>
> I would expect that the pause group is pretty much set and will not get
> new counters but, sure, I can add the quotes just to be on the safe
> side.

Oh, don't get me wrong, I don't believe $name will contain whitespace.
But I would expect shellcheck to complain about the missing quotes.

>> it should either
>> be quoted in the horrible way the else branch does it, or do this much
>> more readable thing instead:
>> 
>>         jq --arg name "$name" '.[].statistics[$name]'
>> 
>
> Thanks! Wasn't aware of this type of jq variable usage but indeed it
> looks better.
>
>> > +	else
>> > +		ethtool --json -S $dev --groups $grp -- --src $src | \
>> 
>> Since you are touching this line -- can you fix the missing quoting,
>> please?
>
> Sure, I will add them.
>
>> 
>> > +			jq '.[]."'"$grp"'"."'$name'"'
>
> And I think $name above needs double quoting as well.

Oh yeah. That's just going to be an absolute confusion of quotes though.
Can you convert to the --arg form as well? I think it should be:

			jq --arg grp "$grp" --arg name "$name" \
				'.[][$grp][$name]'

  reply	other threads:[~2026-03-03 13:27 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25 15:06 [PATCH net-next 0/5] net: dpaa2-mac: export standard statistics Ioana Ciornei
2026-02-25 15:06 ` [PATCH net-next 1/5] net: dpaa2-mac: extend APIs related to statistics Ioana Ciornei
2026-02-25 15:06 ` [PATCH net-next 2/5] net: dpaa2-mac: retrieve MAC statistics in one firmware command Ioana Ciornei
2026-02-27  2:26   ` [net-next,2/5] " Jakub Kicinski
2026-02-27 10:37     ` Ioana Ciornei
2026-03-01 16:09   ` [PATCH net-next 2/5] " Simon Horman
2026-03-02 12:51     ` Ioana Ciornei
2026-02-25 15:06 ` [PATCH net-next 3/5] net: dpaa2-mac: export standard statistics Ioana Ciornei
2026-02-25 15:06 ` [PATCH net-next 4/5] selftests: forwarding: extend ethtool_std_stats_get with pause statistics Ioana Ciornei
2026-02-27 16:38   ` Petr Machata
2026-03-02 13:57     ` Ioana Ciornei
2026-03-03 13:06       ` Petr Machata [this message]
2026-02-25 15:06 ` [PATCH net-next 5/5] selftests: drivers: hw: add tests for the ethtool standard counters Ioana Ciornei
2026-02-25 23:38   ` Andrew Lunn
2026-02-26  7:03     ` Ioana Ciornei
2026-02-26 12:19       ` Ioana Ciornei
2026-02-26 13:31         ` Andrew Lunn
2026-02-26 14:18           ` Ioana Ciornei
2026-02-27  2:25             ` Jakub Kicinski
2026-02-27  7:34               ` Ioana Ciornei
2026-02-27 14:17                 ` Andrew Lunn
2026-02-28  0:24                   ` Jakub Kicinski
2026-02-28  0:23                 ` Jakub Kicinski
2026-02-27  2:22   ` Jakub Kicinski
2026-02-27 13:53     ` Petr Machata
2026-02-28  0:43       ` Jakub Kicinski
2026-02-28  9:11         ` Petr Machata
2026-03-02 12:11           ` Ioana Ciornei
2026-03-03  0:07             ` Jakub Kicinski
2026-03-03 13:53               ` Ioana Ciornei
2026-03-03 16:43                 ` Jakub Kicinski
2026-02-27 15:45   ` Petr Machata
2026-03-02 14:15     ` Ioana Ciornei
2026-03-03 13:30       ` Petr Machata

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=87342hf3h7.fsf@nvidia.com \
    --to=petrm@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=ioana.ciornei@nxp.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.