Skip to content

Commit 0fec37f

Browse files
committed
contest: env_check: fix thee netdev NL state saving
Commit 1bd4244 ("contest: env_check: save netdev NL state") a bunch of netdev state to the checking but ynl wasn't available on the system that run HW tests at the time. So this was entirely dead code. Now that ynl is installed these are causing false positives. Filter out various unstable IDs and stats. Try to give page pools some time to get released. Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 7dbdf47 commit 0fec37f

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

contest/scripts/env_check.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import os
99
import subprocess
1010
import sys
11+
import time
1112

1213

1314
def run_cmd_text(cmd):
@@ -33,8 +34,24 @@ def run_cmd_json(cmd):
3334
return ret
3435

3536

37+
def wait_for_detached_pp():
38+
"""Wait for detached (zombie) page pools to disappear, up to 60s."""
39+
deadline = time.time() + 60
40+
while time.time() < deadline:
41+
pp_all = run_cmd_json("ynl --family netdev --output-json --dump page-pool-get")
42+
if not isinstance(pp_all, list):
43+
break
44+
detached = [pp for pp in pp_all if "detach-time" in pp]
45+
if not detached:
46+
break
47+
time.sleep(1)
48+
49+
3650
def collect_system_state():
3751
"""Collect network interface information."""
52+
53+
wait_for_detached_pp()
54+
3855
state = {
3956
"links": {},
4057
"chans": {},
@@ -70,7 +87,19 @@ def collect_system_state():
7087

7188
cmd = f'ynl --family netdev --output-json {method} {op} '
7289
cmd += "--json '{" + f'"ifindex": {ifindex}' + "}'"
73-
state["netdev-" + op][ifname] = run_cmd_json(cmd)
90+
data = run_cmd_json(cmd)
91+
92+
# Strip attributes that change across runs
93+
drop_keys = {'id', 'napi-id', 'irq', 'inflight', 'inflight-mem'}
94+
if isinstance(data, list):
95+
for obj in data:
96+
for key in drop_keys:
97+
obj.pop(key, None)
98+
elif isinstance(data, dict):
99+
for key in drop_keys:
100+
data.pop(key, None)
101+
102+
state["netdev-" + op][ifname] = data
74103

75104
return state
76105

0 commit comments

Comments
 (0)