ethtool: init tsinfo stats if requested
authorVadim Fedorenko <vadfed@meta.com>
Thu, 30 May 2024 04:08:14 +0000 (21:08 -0700)
committerJakub Kicinski <kuba@kernel.org>
Sat, 1 Jun 2024 22:11:09 +0000 (15:11 -0700)
commit89e281ebff72e6d37dce2df0e142b2909dafb267
tree31b407bba1aa4e9dded68a96f35bb402ce715a58
parent7679935b8bdf8d2bc298b04ed579d1ed78e81907
ethtool: init tsinfo stats if requested

Statistic values should be set to ETHTOOL_STAT_NOT_SET even if the
device doesn't support statistics. Otherwise zeros will be returned as
if they are proper values:

host# ethtool -I -T lo
Time stamping parameters for lo:
Capabilities:
software-transmit
software-receive
software-system-clock
PTP Hardware Clock: none
Hardware Transmit Timestamp Modes: none
Hardware Receive Filter Modes: none
Statistics:
  tx_pkts: 0
  tx_lost: 0
  tx_err: 0

Fixes: 0e9c127729be ("ethtool: add interface to read Tx hardware timestamping statistics")
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Vadim Fedorenko <vadfed@meta.com>
Reviewed-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
Link: https://lore.kernel.org/r/20240530040814.1014446-1-vadfed@meta.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ethtool/tsinfo.c