Skip to content

Commit

Permalink
tools: ynl: ethtool.py: Output timestamping statistics from tsinfo-ge…
Browse files Browse the repository at this point in the history
…t operation

Print the nested stats attribute containing timestamping statistics when
the --show-time-stamping flag is used.

  [root@binary-eater-vm-01 linux-ethtool-ts]# ./tools/net/ynl/ethtool.py --show-time-stamping mlx5_1
  Time stamping parameters for mlx5_1:
  Capabilities:
    hardware-transmit
    hardware-receive
    hardware-raw-clock
  PTP Hardware Clock: 0
  Hardware Transmit Timestamp Modes:
    off
    on
  Hardware Receive Filter Modes:
    none
    all
  Statistics:
    tx-pkts: 8
    tx-lost: 0
    tx-err: 0

Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Link: https://lore.kernel.org/r/20240403212931.128541-8-rrameshbabu@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Rahul Rameshbabu authored and Jakub Kicinski committed Apr 6, 2024
1 parent ff8877b commit 2e0e148
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tools/net/ynl/ethtool.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,13 @@ def main():
return

if args.show_time_stamping:
tsinfo = dumpit(ynl, args, 'tsinfo-get')
req = {
'header': {
'flags': 'stats',
},
}

tsinfo = dumpit(ynl, args, 'tsinfo-get', req)

print(f'Time stamping parameters for {args.device}:')

Expand All @@ -338,6 +344,9 @@ def main():

print('Hardware Receive Filter Modes:')
[print(f'\t{v}') for v in bits_to_dict(tsinfo['rx-filters'])]

print('Statistics:')
[print(f'\t{k}: {v}') for k, v in tsinfo['stats'].items()]
return

print(f'Settings for {args.device}:')
Expand Down

0 comments on commit 2e0e148

Please sign in to comment.