public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Rahul Rameshbabu <rrameshbabu@nvidia•com>
To: Jakub Kicinski <kuba@kernel•org>
Cc: ahmed.zaki@intel•com, aleksander.lobakin@intel•com,
	alexandre.torgue@foss•st.com, andrew@lunn•ch, corbet@lwn•net,
	davem@davemloft•net, dtatulea@nvidia•com, edumazet@google•com,
	gal@nvidia•com, hkallweit1@gmail•com, jacob.e.keller@intel•com,
	jiri@resnulli•us, joabreu@synopsys•com, justinstitt@google•com,
	kory.maincent@bootlin•com, leon@kernel•org,
	linux-doc@vger•kernel.org, linux-kernel@vger•kernel.org,
	liuhangbin@gmail•com, maxime.chevallier@bootlin•com,
	netdev@vger•kernel.org, pabeni@redhat•com,
	paul.greenwalt@intel•com, przemyslaw.kitszel@intel•com,
	rdunlap@infradead•org, richardcochran@gmail•com,
	saeed@kernel•org, tariqt@nvidia•com, vadim.fedorenko@linux•dev,
	vladimir.oltean@nxp•com, wojciech.drewek@intel•com
Subject: Re: [PATCH RFC v2 1/6] ethtool: add interface to read Tx hardware timestamping statistics
Date: Thu, 14 Mar 2024 10:01:49 -0700	[thread overview]
Message-ID: <87v85ovj4d.fsf@nvidia.com> (raw)
In-Reply-To: <20240312165346.14ec1941@kernel.org>


On Tue, 12 Mar, 2024 16:53:46 -0700 Jakub Kicinski <kuba@kernel•org> wrote:
> On Sat,  9 Mar 2024 00:44:35 -0800 Rahul Rameshbabu wrote:
>> Multiple network devices that support hardware timestamping appear to have
>> common behavior with regards to timestamp handling. Implement common Tx
>> hardware timestamping statistics in a tx_stats struct_group. Common Rx
>> hardware timestamping statistics can subsequently be implemented in a
>> rx_stats struct_group for ethtool_ts_stats.
>
>>  Documentation/netlink/specs/ethtool.yaml | 20 +++++++++
>>  include/linux/ethtool.h                  | 21 ++++++++++
>>  include/uapi/linux/ethtool_netlink.h     | 15 +++++++
>>  net/ethtool/tsinfo.c                     | 52 +++++++++++++++++++++++-
>>  4 files changed, 107 insertions(+), 1 deletion(-)
>
> Feels like we should mention the new stats somehow in 
> Documentation/networking/ethtool-netlink.rst
>
>> diff --git a/Documentation/netlink/specs/ethtool.yaml b/Documentation/netlink/specs/ethtool.yaml
>> index 197208f419dc..f99b003c78c0 100644
>> --- a/Documentation/netlink/specs/ethtool.yaml
>> +++ b/Documentation/netlink/specs/ethtool.yaml
>> @@ -559,6 +559,21 @@ attribute-sets:
>>        -
>>          name: tx-lpi-timer
>>          type: u32
>> +  -
>> +    name: ts-stat
>> +    attributes:
>> +      -
>> +        name: pad
>> +        type: pad
>
> You can remove the pad entry, and...
>

You need the pad to match with ETHTOOL_A_TS_STAT_PAD (which similar to
other ethtool stats currently defined). Otherwise, you run into the
following.... mm-stat and fec-stat are good examples.

  [root@binary-eater-vm-01 linux-ethtool-ts]# ./tools/net/ynl/ethtool.py --show-time-stamping mlx5_1
  Traceback (most recent call last):
    File "/root/linux-ethtool-ts/tools/net/ynl/lib/ynl.py", line 598, in _decode
      attr_spec = attr_space.attrs_by_val[attr.type]
                  ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  KeyError: 4

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/root/linux-ethtool-ts/./tools/net/ynl/ethtool.py", line 437, in <module>
      main()
    File "/root/linux-ethtool-ts/./tools/net/ynl/ethtool.py", line 333, in main
      tsinfo = dumpit(ynl, args, 'tsinfo-get', req)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/root/linux-ethtool-ts/./tools/net/ynl/ethtool.py", line 91, in dumpit
      reply = ynl.dump(op_name, { 'header': {} } | extra)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/root/linux-ethtool-ts/tools/net/ynl/lib/ynl.py", line 873, in dump
      return self._op(method, vals, [], dump=True)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/root/linux-ethtool-ts/tools/net/ynl/lib/ynl.py", line 858, in _op
      rsp_msg = self._decode(decoded.raw_attrs, op.attr_set.name)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/root/linux-ethtool-ts/tools/net/ynl/lib/ynl.py", line 607, in _decode
      subdict = self._decode(NlAttrs(attr.raw), attr_spec['nested-attributes'], search_attrs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/root/linux-ethtool-ts/tools/net/ynl/lib/ynl.py", line 601, in _decode
      raise Exception(f"Space '{space}' has no attribute with value '{attr.type}'")
  Exception: Space 'ts-stat' has no attribute with value '4'

>> +enum {
>> +	ETHTOOL_A_TS_STAT_UNSPEC,
>> +	ETHTOOL_A_TS_STAT_PAD,
>> +
>> +	ETHTOOL_A_TS_STAT_TX_PKT,			/* array, u64 */
>> +	ETHTOOL_A_TS_STAT_TX_LOST,			/* array, u64 */
>> +	ETHTOOL_A_TS_STAT_TX_ERR,			/* array, u64 */
>
> I don't think these are arrays.
>
>> +
>> +	/* add new constants above here */
>> +	__ETHTOOL_A_TS_STAT_CNT,
>> +	ETHTOOL_A_TS_STAT_MAX = (__ETHTOOL_A_TS_STAT_CNT - 1)
>> +
>> +};

--
Thanks,

Rahul Rameshbabu

  parent reply	other threads:[~2024-03-14 17:06 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-23 19:24 [PATCH RFC net-next v1 0/6] ethtool HW timestamping statistics Rahul Rameshbabu
2024-02-23 19:24 ` [PATCH RFC net-next v1 1/6] ethtool: add interface to read Tx hardware " Rahul Rameshbabu
2024-02-23 21:07   ` Jacob Keller
2024-02-23 22:21     ` Rahul Rameshbabu
2024-02-23 22:48       ` Jacob Keller
2024-02-23 23:43         ` Rahul Rameshbabu
2024-02-26 19:54           ` Jacob Keller
2024-03-07 18:47             ` Rahul Rameshbabu
2024-03-08  3:29               ` Jacob Keller
2024-03-08  5:09                 ` Rahul Rameshbabu
2024-03-08 22:28                   ` Jacob Keller
2024-03-08 22:30                     ` Rahul Rameshbabu
2024-02-26  8:59   ` Köry Maincent
2024-02-26 10:09   ` Köry Maincent
2024-02-29  2:05   ` Jakub Kicinski
2024-02-29 22:20     ` Rahul Rameshbabu
2024-02-23 19:24 ` [PATCH RFC net-next v1 2/6] net/mlx5e: Introduce lost_cqe statistic counter for PTP Tx port timestamping CQ Rahul Rameshbabu
2024-02-23 19:24 ` [PATCH RFC net-next v1 3/6] net/mlx5e: Introduce timestamps statistic counter for Tx DMA layer Rahul Rameshbabu
2024-02-23 19:24 ` [PATCH RFC net-next v1 4/6] net/mlx5e: Implement ethtool hardware timestamping statistics Rahul Rameshbabu
2024-02-26  9:26   ` Köry Maincent
2024-02-23 19:24 ` [PATCH RFC net-next v1 5/6] tools: ynl: ethtool.py: Make tool invokable from any CWD Rahul Rameshbabu
2024-02-23 21:08   ` Jacob Keller
2024-02-23 22:39     ` Rahul Rameshbabu
2024-02-29  2:08       ` Jakub Kicinski
2024-02-23 19:24 ` [PATCH RFC net-next v1 6/6] tools: ynl: ethtool.py: Add ts ethtool statistics group Rahul Rameshbabu
2024-02-23 21:00 ` [PATCH RFC net-next v1 0/6] ethtool HW timestamping statistics Jacob Keller
2024-02-23 21:12   ` Jacob Keller
2024-02-23 22:47   ` Rahul Rameshbabu
2024-03-09  8:44 ` [PATCH RFC v2 " Rahul Rameshbabu
2024-03-09  8:44   ` [PATCH RFC v2 1/6] ethtool: add interface to read Tx hardware " Rahul Rameshbabu
2024-03-12 23:53     ` Jakub Kicinski
2024-03-14  0:26       ` Rahul Rameshbabu
2024-03-14  0:41         ` Jakub Kicinski
2024-03-14  0:50           ` Rahul Rameshbabu
2024-03-14  1:40             ` Jakub Kicinski
2024-03-14  4:19               ` Rahul Rameshbabu
2024-03-14 17:50               ` Keller, Jacob E
2024-03-14 18:48                 ` Rahul Rameshbabu
2024-03-14 17:01       ` Rahul Rameshbabu [this message]
2024-03-14 17:59         ` Jakub Kicinski
2024-03-14 18:43           ` Rahul Rameshbabu
2024-03-14 19:06             ` Jakub Kicinski
2024-03-14 20:16               ` Rahul Rameshbabu
2024-03-09  8:44   ` [PATCH RFC v2 2/6] net/mlx5e: Introduce lost_cqe statistic counter for PTP Tx port timestamping CQ Rahul Rameshbabu
2024-03-09  8:44   ` [PATCH RFC v2 3/6] net/mlx5e: Introduce timestamps statistic counter for Tx DMA layer Rahul Rameshbabu
2024-03-09  8:44   ` [PATCH RFC v2 4/6] net/mlx5e: Implement ethtool hardware timestamping statistics Rahul Rameshbabu
2024-03-09  8:44   ` [PATCH RFC v2 5/6] tools: ynl: ethtool.py: Make tool invokable from any CWD Rahul Rameshbabu
2024-03-11 12:43     ` Köry Maincent
2024-03-09  8:44   ` [PATCH RFC v2 6/6] tools: ynl: ethtool.py: Output timestamping statistics from tsinfo-get operation Rahul Rameshbabu
2024-03-12 23:55     ` Jakub Kicinski
2024-03-14  0:22       ` Rahul Rameshbabu
2024-03-14  0:47         ` Jakub Kicinski
2024-03-14  6:07           ` Rahul Rameshbabu
2024-03-14 18:05             ` Jakub Kicinski
2024-03-14 18:39               ` Rahul Rameshbabu
2024-03-14 20:04           ` Jakub Kicinski
2024-03-14 20:05             ` Rahul Rameshbabu

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=87v85ovj4d.fsf@nvidia.com \
    --to=rrameshbabu@nvidia$(echo .)com \
    --cc=ahmed.zaki@intel$(echo .)com \
    --cc=aleksander.lobakin@intel$(echo .)com \
    --cc=alexandre.torgue@foss$(echo .)st.com \
    --cc=andrew@lunn$(echo .)ch \
    --cc=corbet@lwn$(echo .)net \
    --cc=davem@davemloft$(echo .)net \
    --cc=dtatulea@nvidia$(echo .)com \
    --cc=edumazet@google$(echo .)com \
    --cc=gal@nvidia$(echo .)com \
    --cc=hkallweit1@gmail$(echo .)com \
    --cc=jacob.e.keller@intel$(echo .)com \
    --cc=jiri@resnulli$(echo .)us \
    --cc=joabreu@synopsys$(echo .)com \
    --cc=justinstitt@google$(echo .)com \
    --cc=kory.maincent@bootlin$(echo .)com \
    --cc=kuba@kernel$(echo .)org \
    --cc=leon@kernel$(echo .)org \
    --cc=linux-doc@vger$(echo .)kernel.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=liuhangbin@gmail$(echo .)com \
    --cc=maxime.chevallier@bootlin$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=pabeni@redhat$(echo .)com \
    --cc=paul.greenwalt@intel$(echo .)com \
    --cc=przemyslaw.kitszel@intel$(echo .)com \
    --cc=rdunlap@infradead$(echo .)org \
    --cc=richardcochran@gmail$(echo .)com \
    --cc=saeed@kernel$(echo .)org \
    --cc=tariqt@nvidia$(echo .)com \
    --cc=vadim.fedorenko@linux$(echo .)dev \
    --cc=vladimir.oltean@nxp$(echo .)com \
    --cc=wojciech.drewek@intel$(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