From: Andrew Lunn <andrew@lunn.ch>
To: Mohan.Prasad@microchip.com
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
edumazet@google.com, pabeni@redhat.com, shuah@kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
horms@kernel.org, brett.creeley@amd.com, rosenp@gmail.com,
UNGLinuxDriver@microchip.com, willemb@google.com
Subject: Re: [PATCH net-next v2 1/3] selftests: nic_basic_tests: Add selftest file for basic tests of NIC
Date: Thu, 19 Sep 2024 16:51:18 +0200 [thread overview]
Message-ID: <55037ff4-aa06-4cd4-bbc1-b1e714fa1fd4@lunn.ch> (raw)
In-Reply-To: <DM6PR11MB42363E9DC481B09277369B5A83632@DM6PR11MB4236.namprd11.prod.outlook.com>
On Thu, Sep 19, 2024 at 10:44:11AM +0000, Mohan.Prasad@microchip.com wrote:
> Hello Andrew,
>
> Thank you for the suggestion.
>
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the
> > content is safe
> >
> > > > Since you have batteries included python:
> > > >
> > > > ethtool --json enp2s0
> > > > [sudo] password for andrew:
> > > > [ {
> > > > "ifname": "enp2s0",
> > > > "supported-ports": [ "TP","MII" ],
> > > > "supported-link-modes": [
> > > > "10baseT/Half","10baseT/Full","100baseT/Half","100baseT/Full","1000b
> > > > aseT/
> > > > Full" ],
> > > > "supported-pause-frame-use": "Symmetric Receive-only",
> > > > "supports-auto-negotiation": true,
> > > > "supported-fec-modes": [ ],
> > > > "advertised-link-modes": [
> > > > "10baseT/Half","10baseT/Full","100baseT/Half","100baseT/Full","1000b
> > > > aseT/
> > > > Full" ],
> > > > "advertised-pause-frame-use": "Symmetric Receive-only",
> > > > "advertised-auto-negotiation": true,
> > > > "advertised-fec-modes": [ ],
> > > > "auto-negotiation": false,
> > > > "master-slave-cfg": "preferred slave",
> > > > "master-slave-status": "unknown",
> > > > "port": "Twisted Pair",
> > > > "phyad": 0,
> > > > "transceiver": "external",
> > > > "supports-wake-on": "pumbg",
> > > > "wake-on": "d",
> > > > "link-detected": false
> > > > } ]
> > > >
> > > > You can use a json library to do all the parsing for you.
> > >
> > > I tried running the --json option with the ethtool ("ethtool --json enp9s0"),
> > however I am not getting the above output.
> > > Instead it always throws "ethtool: bad command line argument(s)"
> > > I am figuring out what might be missing (or any suggestions would be
> > helpful).
> >
> > Are you using real ethtool, or busybox? What version of ethtool? I'm using
> > 6.10, but it looks like JSON support was added somewhere around 5.10.
>
> I have been using ethtool 6.7, updating to ethtool 6.10 solved the problem.
It would be good to gracefully handle this. Have the test fail with a
human readable error indicating ethtool is too old, rather than just
throwing an exception etc.
Digging through the git history, it seems like 6.10 was actually the
first version that supported this:
commit bd1341cd2146bfb89e1239546299102339acbf4d
Author: Fabian Pfitzner <f.pfitzner@pengutronix.de>
Date: Fri Jul 19 10:55:44 2024 +0200
add json support for base command
Most subcommands already implement json support for their output. The
base command (without supplying any subcommand) still lacks this
option. This patch implments the needed changes to get json output,
which is printed via "ethtool --json [iface]"
The following design decision were made during implementation:
- json values like Yes/No are printed as true/false
- values that are "Unknown" are not printed at all
- all other json values are not changed
- keys are printed in lowercase with dashes in between
Signed-off-by: Fabian Pfitzner <f.pfitzner@pengutronix.de>
Andrew
next prev parent reply other threads:[~2024-09-19 14:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-17 2:34 [PATCH net-next v2 0/3] nic_basic_tests: Add selftest for doing basic tests of NIC driver Mohan Prasad J
2024-09-17 2:34 ` [PATCH net-next v2 1/3] selftests: nic_basic_tests: Add selftest file for basic tests of NIC Mohan Prasad J
2024-09-17 15:35 ` Andrew Lunn
2024-09-18 10:30 ` Mohan.Prasad
2024-09-18 12:05 ` Andrew Lunn
2024-09-19 10:44 ` Mohan.Prasad
2024-09-19 14:51 ` Andrew Lunn [this message]
2024-09-17 15:48 ` Andrew Lunn
2024-09-18 10:32 ` Mohan.Prasad
2024-09-18 12:11 ` Andrew Lunn
2024-09-17 15:56 ` Andrew Lunn
2024-09-18 10:35 ` Mohan.Prasad
2024-09-17 2:34 ` [PATCH net-next v2 2/3] selftests: nic_basic_tests: Add selftest case for speed and duplex state checks Mohan Prasad J
2024-09-18 12:38 ` Willem de Bruijn
2024-09-20 4:56 ` Mohan.Prasad
2024-09-17 2:34 ` [PATCH net-next v2 3/3] selftests: nic_basic_tests: Add selftest case for throughput check Mohan Prasad J
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=55037ff4-aa06-4cd4-bbc1-b1e714fa1fd4@lunn.ch \
--to=andrew@lunn.ch \
--cc=Mohan.Prasad@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=brett.creeley@amd.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--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=rosenp@gmail.com \
--cc=shuah@kernel.org \
--cc=willemb@google.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