mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
selftests: drv-net: assume stats refresh is 0 if no ethtool -c support
Tests using HW stats wait for them to stabilize, using data from ethtool -c as the delay. Not all drivers implement ethtool -c so handle the errors gracefully. Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20241220003116.1458863-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -5,7 +5,7 @@ import time
|
||||
from pathlib import Path
|
||||
from lib.py import KsftSkipEx, KsftXfailEx
|
||||
from lib.py import ksft_setup
|
||||
from lib.py import cmd, ethtool, ip
|
||||
from lib.py import cmd, ethtool, ip, CmdExitFailure
|
||||
from lib.py import NetNS, NetdevSimDev
|
||||
from .remote import Remote
|
||||
|
||||
@@ -234,7 +234,12 @@ class NetDrvEpEnv:
|
||||
Good drivers will tell us via ethtool what their sync period is.
|
||||
"""
|
||||
if self._stats_settle_time is None:
|
||||
data = ethtool("-c " + self.ifname, json=True)[0]
|
||||
data = {}
|
||||
try:
|
||||
data = ethtool("-c " + self.ifname, json=True)[0]
|
||||
except CmdExitFailure as e:
|
||||
if "Operation not supported" not in e.cmd.stderr:
|
||||
raise
|
||||
|
||||
self._stats_settle_time = 0.025 + \
|
||||
data.get('stats-block-usecs', 0) / 1000 / 1000
|
||||
|
||||
Reference in New Issue
Block a user