From: David Wei Date: Sat, 26 Apr 2025 19:55:25 +0000 (-0700) Subject: io_uring/zcrx: selftests: parse json from ethtool -g X-Git-Tag: v6.16-rc1~132^2~196^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6fbb4d3f7262771c376d1176e04811645d3c0c7b;p=thirdparty%2Flinux.git io_uring/zcrx: selftests: parse json from ethtool -g Parse JSON from ethtool -g instead of parsing text output. Signed-off-by: David Wei Reviewed-by: Joe Damato Link: https://patch.msgid.link/20250426195525.1906774-3-dw@davidwei.uk Signed-off-by: Jakub Kicinski --- diff --git a/tools/testing/selftests/drivers/net/hw/iou-zcrx.py b/tools/testing/selftests/drivers/net/hw/iou-zcrx.py index a19550419771d..aef43f82edd56 100755 --- a/tools/testing/selftests/drivers/net/hw/iou-zcrx.py +++ b/tools/testing/selftests/drivers/net/hw/iou-zcrx.py @@ -9,10 +9,8 @@ from lib.py import bkg, cmd, defer, ethtool, rand_port, wait_port_listen def _get_current_settings(cfg): - output = ethtool(f"-g {cfg.ifname}", host=cfg.remote).stdout - rx_ring = re.findall(r'RX:\s+(\d+)', output) - hds_thresh = re.findall(r'HDS thresh:\s+(\d+)', output) - return (int(rx_ring[1]), int(hds_thresh[1])) + output = ethtool(f"-g {cfg.ifname}", json=True, host=cfg.remote)[0] + return (output['rx'], output['hds-thresh']) def _get_combined_channels(cfg):